I have both Excel 2003 and Excel 2010 on my machine. I'm using VBA in Access 2010 to open 2010 .xlsx files in Excel, but I notice they seem to be "opening" in Excell 2003 because that little "Converting data" dialog box pops up for a moment.
Is there an easy way to be sure that Excel 2010 "opens" before the files open?
Thanks,
Ed
I don't have two versions of Excel on my computer so cannot test but I would think that the following would open the default Excel version, which I assume you would have as 2010, and then open the file. The debug.print will tell you which Excel version is opened.
Alternatively, do you need 2003? Why not uninstall?
Dim xlApp As Excel.Application
Set xlApp = CreateObject("Excel.Application")
xlApp.visible = TRUE
xlApp.Workbooks.Open "C:\FolderName\FileName.xlsx", True, False
Debug.Print xlApp.Version
set xlApp = NOTHING
EDIT: Sorry, I should also note that this opens a new instance of Excel on your machine, at the end of what you want to do you should use
xlApp.Quit
To close the instance so you don't have multiple instances running on your machine.
Also, if you need to see the spreadsheet for any reason
xlApp.Visible = True
Will do it for you
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With