PDA

View Full Version : GetObject method in Excel 2004 for MacOS



lclqt12
01-22-2007, 04:32 PM
I have a file that run code below :

Dim wb as Variant
set wb = GetObject(path) 'path is the path of excel file

It can't be run. It's alert : file name or class not found ....
But when i create new file and the path is pointed to new file. It's run OK.

I'm sure that path is right. Because when i run
Dim wb as Variant
set wb = Excel.WorkSheets.Open(path) 'path is the path of excel file

It's run OK. So i think the file that i try to open has some special things that GetObject method in Mac can't be run ( in windows, it run well )

And i don't want to use Excel.WorkSheets.Open. Because, it's slow than GetObject method. So how can i solve this problem?

shades
01-22-2007, 07:47 PM
Howdy. GetObject works in Mac VBA. However, keep in mind that the path for Mac is different than for Windows. Make sure you identify the path correctly (not just the folder, but the correct "punctuation").


Dim CADObject As Object
Set CADObject = GetObject("Macintosh HD:Users:Shared:MyExcelfile.xls")

lclqt12
01-22-2007, 10:46 PM
I'm sure that path is right. Because i can open that file by using
Excel.WorkBooks.Open(path).