11/23/2023 0 Comments Os x word macrosI'm converting a Windows system amounting to thousands of lines of code in several Excel workbooks and one Word file to work on Macs and this is a simple test routine to check out the process of opening an Excel file from a macro in the Word file. (And please don't get sidetracked about that - it's not the issue here.) I'm doing 'CreateObject' rather than 'GetObject' because when the real-life process which will be developed from this trial finishes I want to shut down only this instance, not all the other instances:there will be at least one. The CreateObject works and a 'Book1' Excel file is shown. The Word file containing this macro is also on Dropbox and when run under Windows it runs through with no errors. The filepath names are correct and refer to the same file on Dropbox and are pasted in from File Explorer and Finder as appropriate. I believe I'm doing this pretty-much the standard way given in many examples on forums etc. I get the same in the error handler too when trying to shut it down. XlApp.Quit ' this also fails on Mac with 'Object doesn't support this property or method' if Set xlBook failedĪs it says above, the failure occurs at the 'Set xlBook = (FileName:=strWorkbookName)' line and gives Error 438, 'Object doesn't support this property or method'. MsgBox Err.Number & vbLf & Err.Description MsgBox "A1=" & xlBook.Sheets("Sheet1").Range("A1") ' just some text to show it's working. Set xlBook = (FileName:=strWorkbookName) '<<< Fails on Mac Set xlApp = CreateObject("Excel.Application") StrWorkbookName = "C:\Users\billh\Dropbox\CNTSA\mactesting\testrunningawordmacrofromExcel.xlsm" StrWorkbookName = "/Users/billh/Dropbox/CNTSA/mactesting/testrunningawordmacrofromExcel.xlsm" ' 'Object doesn't suport this property or method' ' WORKS SEAMLESSLY ON WINDOWS, FAILS AT THE 'OPEN' STATEMENT ON MAC.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |