Information générale
Catégorie:
COM/DCOM et OLE Automation
Titre:
Trying to open an Excel file Part 2
Versions des environnements
The reason I'm "trying to open an Excel file" is to make sure the first worksheet is of the proper name, otherwise rename it (or just rename it anyway) so when I pull information from that file I can properly reference which worksheet to use.
I may be trying to go about this in an awkward way...
****New code to change workbook name START
oleApp = Createobject("Excel.Application") && Start Excel.
oleApp.Workbooks.Open.FILENAME:=(&xlsfile)
oleApp.Sheets("Sheet1").Select
If oleApp.Sheets("Sheet1").Name = "Sheet1"
oleApp.Sheets("Sheet1").Name = "new order file"
Endif
If oleApp.Sheets("NOF").Name = "NOF"
oleApp.Sheets("NOF").Name = "new order file"
Endif
oleApp.ActiveWorkbook.Save
oleApp.ActiveWindow.Close
oleApp.Quit &&Quit Excel
****New code to change workbook name END
...and I'm still not sure it will respond correctly once it does recognize the xlsfile.
Thanks!
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement