FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Help with Excel - insert macro
Posts: 437
Joined: Fri Oct 07, 2005 12:56 PM
Help with Excel - insert macro
Posted: Thu Feb 04, 2010 06: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.
Posts: 300
Joined: Wed Jul 11, 2007 11:06 AM
Re: Help with Excel - insert macro
Posted: 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

Posts: 1467
Joined: Mon Oct 10, 2005 11:26 AM
Re: Help with Excel - insert macro
Posted: Fri Feb 05, 2010 04: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. 25.12 - Harbour 3.2.0 (May 2025) - xHarbour Builder (January 2020) - Bcc773

Posts: 437
Joined: Fri Oct 07, 2005 12:56 PM
Re: Help with Excel - insert macro
Posted: 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.
Posts: 300
Joined: Wed Jul 11, 2007 11:06 AM
Re: Help with Excel - insert macro
Posted: Sun Feb 07, 2010 11:04 AM

Michel,
Sorry but i never try to run macro and outlook .

Continue the discussion