pvp1
asked on
How to execute a word MACRO from Delphi?
Hello All,
My application is having a OLE continer with a word document as an object. I have created a Word Macro called 'StartUp'. I have to execute this Macro when the word document(Oleobject) is active.
I tried to execute it like:
Olecontiner1.Oleobject.Run Macro('Sta rtUp');
-- But the method RunMacro is not recognized by Delphi.
Could you provide me a suggestion how to execute a macro from Delphi?
Thanks
PVP
My application is having a OLE continer with a word document as an object. I have created a Word Macro called 'StartUp'. I have to execute this Macro when the word document(Oleobject) is active.
I tried to execute it like:
Olecontiner1.Oleobject.Run
-- But the method RunMacro is not recognized by Delphi.
Could you provide me a suggestion how to execute a macro from Delphi?
Thanks
PVP
ASKER
Hello Markus!
With this statement i had a runtime exception. WordObject(OleContinerObje ct) can not support the Method 'Run' !!! Is there any method which can support OleObject?
thanks
pvp
With this statement i had a runtime exception. WordObject(OleContinerObje
thanks
pvp
Don't know, maybe you first have to add the template to the list of templates for the current session.
oleContainer1.OleObject.ap plication. AddIns.Add ('C:\{...} StartUp.do t', true);
and after that
application.run("StartUp") ;
But I'm not really sure about it; just try it ;0)
Markus
oleContainer1.OleObject.ap
and after that
application.run("StartUp")
But I'm not really sure about it; just try it ;0)
Markus
ASKER
Hello,
i tried directly like ..
oleContainer1.OleObject.ap plication. run('Start Up');
it is able to start executing the Macro, StartUp... but immediately i am getting the runtime error :
Microsoft Visual Basic, Runtime error: 4605
'Thsi method or property is not available because this document is in another application'
could anybody help how to solve this problem?
Thanks
pvp
i tried directly like ..
oleContainer1.OleObject.ap
it is able to start executing the Macro, StartUp... but immediately i am getting the runtime error :
Microsoft Visual Basic, Runtime error: 4605
'Thsi method or property is not available because this document is in another application'
could anybody help how to solve this problem?
Thanks
pvp
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
WordApplication1.Run('Star
Markus