Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Need to close and re-open excel for macro to fire
Message
De
13/08/2007 12:29:45
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Need to close and re-open excel for macro to fire
Versions des environnements
Visual FoxPro:
VFP 9
OS:
Windows XP
Database:
Visual FoxPro
Divers
Thread ID:
01247849
Message ID:
01247849
Vues:
69
Hi all,

I have certain spreadsheets that are created programatically through VFP, which are originally created from basic templates which contain macros, which all the new spreadsheets inherit. These macros also play a part in populating the cells.

Now I face a unique problem. After creating/opening an excel file through VFP, and creating a new sheet in a spreadsheet using a macro called CreateSheet (below), I need to save,close and reopen the file, in order for the other macros to fire. Otherwise they do not fire!

This process can take upto 30 seconds extra!

My code, below
oExcel=GetObject(,"Excel.Application")

WITH oexcel
   .Run("Macrofile.xls!CreateSheet")				
   .Activeworkbook.save
   .Activeworkbook.close && closing and reopening to secure  all data
   .workbooks.open('c:\devstudio\panorama\'+lcgang+'.xls')
   .Run("Macrofile.XLS!NewSheetName")
   DO Prgfillsheet
ENDWITH
Thanks in advance,

Regards,

Steve
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform