Help with Excel - insert macro

Help with Excel - insert macro

Postby Rimantas » Thu Feb 04, 2010 6:27 pm

Hi ,
It is needful to run in Excel application one macro through CreateObject( "Excel.Application" ) . After research I found , that macro I can run like something that - oExc:Run( "Macro name" ) . But the problems is to create macro inside this Excel book , in runtime of Fwh apllication . I didn't found how to do that ... :( . Maybe you know how to do something similar ? The macro contains ~ 20 strings - some needful command ...

With best regards ! Rimantas
Rimantas U.
User avatar
Rimantas
 
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania

Re: Help with Excel - insert macro

Postby Jack » Fri Feb 05, 2010 11:43 am

I had the same situation :
I write my macro in a different xls file .
I open it first,then i open the good xls file .
After that i execute the macro from the first xls .

oxls:WorkBooks:Open("G:\tables\MACRODMEDI.XLS")
oBookm := oxls:Get( "ActiveWorkBook")
oxls:WorkBooks:Open("myxlsfile.xls")
oBook := oxls:Get( "ActiveWorkBook")
oSheet := oxls:Get( "ActiveSheet" )
oXls:run("MACRODMEDI.XLS!ARCHF",wnarch) && wnarch is a parameter i pass to the macro (function)
sysrefresh()
oBookm:close()
oxls:Sheets("Actif"):select()
oSheet := oxls:Get( "ActiveSheet" )


Hope that will help you
Jack
 
Posts: 280
Joined: Wed Jul 11, 2007 11:06 am

Re: Help with Excel - insert macro

Postby driessen » Fri Feb 05, 2010 4:20 pm

Jack,

Is it possible to run Outlook-macros the same way ?
Do you have any experience with Outlook ?

If so, can you provide an example ?

Thanks a lot in advance.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.02 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc77
User avatar
driessen
 
Posts: 1399
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Help with Excel - insert macro

Postby Rimantas » Sat Feb 06, 2010 10:40 am

Jack wrote: oxls:WorkBooks:Open("G:\tables\MACRODMEDI.XLS")
oBookm := oxls:Get( "ActiveWorkBook")
oxls:WorkBooks:Open("myxlsfile.xls")
oBook := oxls:Get( "ActiveWorkBook")
oSheet := oxls:Get( "ActiveSheet" )
oXls:run("MACRODMEDI.XLS!ARCHF",wnarch) && wnarch is a parameter i pass to the macro (function)
sysrefresh()
oBookm:close()
oxls:Sheets("Actif"):select()
oSheet := oxls:Get( "ActiveSheet" )


Many thanks , Jack , to you !

With best regards ! Rimantas
Rimantas U.
User avatar
Rimantas
 
Posts: 437
Joined: Fri Oct 07, 2005 12:56 pm
Location: Utena , Lithuania

Re: Help with Excel - insert macro

Postby Jack » Sun Feb 07, 2010 11:04 am

Michel,
Sorry but i never try to run macro and outlook .
Jack
 
Posts: 280
Joined: Wed Jul 11, 2007 11:06 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 32 guests