Consulting

Results 1 to 3 of 3

Thread: GetObject method in Excel 2004 for MacOS

  1. #1

    GetObject method in Excel 2004 for MacOS

    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?

  2. #2
    Mac Moderator VBAX Expert shades's Avatar
    Joined
    May 2004
    Location
    Kansas City, USA
    Posts
    638
    Location
    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").

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

    Software: LibreOffice 3.3 on Mac OS X 10.6.5
    (retired Excel 2003 user, 3.28.2008 )
    Humanware: Older than dirt
    --------------------
    old, slow, and confused
    but at least I'm inconsistent!

    Rich

  3. #3
    I'm sure that path is right. Because i can open that file by using
    Excel.WorkBooks.Open(path).

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •