PDA

View Full Version : Acad & Excel



MikeJarosz
2008-05-15, 04:09 PM
I have been harvesting data from Acad drawings and dumping it into Excel for years now. Just when you think you've mastered the technique, something new comes up.

I have two versions of Excel installed, 2003 and 2007. The firm at large uses 2003. I have 2007 for evaluation and testing and I am developing an Acad VBA application that exports to Excel. I will need to distribute the application in 2003. My problem is, when I start Excel from VBA, I get 2007, not the 2003 I want.




Dim XL As Excel.Application
Set XL = CreateObject("Excel.Application")



Any ideas how I can force 2003 to start?

saustin
2008-05-15, 04:48 PM
Set XL = CreateObject("Excel.Application.11")

ska

rkmcswain
2008-05-15, 04:54 PM
Take a look at http://support.microsoft.com/kb/240794

MikeJarosz
2008-05-15, 06:42 PM
Set XL = CreateObject("Excel.Application.11")

ska

I see where the 11 & 12 comes from:

c:/Program Files/Microsoft Office/OFFICE11/EXCEL.EXE
c:/Program Files/Microsoft Office/Office12/EXCEL.EXE

Excel.Application.12 brings up 2007. Unfortunately, Excel.Application.11 brings up 2007 too! Maybe the registry has been altered to point to 2007?

steve.patten
2008-05-20, 03:26 PM
Exactly right- my understanding is the registry accepts the last program installed as the default for any "type" of file (like .xls).

Ed Jobe
2008-05-20, 03:46 PM
Exactly right- my understanding is the registry accepts the last program installed as the default for any "type" of file (like .xls).

The registry is a little more complicated than that. The part of the registry being dealt with here is the HKEY_CLASSES section. When you use the CreateObect or GetObject functions, the argument requires a class string. Without the number suffix, its version generic, that is the latest version is used. If you require a specific version, then you need to specify the fully qualified class name.

The program that gets launched for a certain file type is controlled in a different area of the registry. The gui for that is in Explorer>Tools>OptionsFile Types.