ZweiBieren
10-16-2024, 05:46 PM
I get an "object required" error for an expression that works fine in the preceding statement. What I am trying to do is
Set mypath = Excel.ActiveWorkbook.Path
For testing I've broken it into steps. If I comment out the "set mypath" line, the two MsgBox lines display the expected values. Note that this includes printing wbxx.Path. But if I leave in the "set mypath" it fails on that line.
If mypath is declared, the result is a compile time error
31821
If I omit the declaration of mypath, there is a runtime error.
31822
WHAT is going on?
How do I get the path to the current workbook?
I am still on VBA 7.1.1143. But Workbook.Path really ought to work.
Thanks, Fred Hansen
Set mypath = Excel.ActiveWorkbook.Path
For testing I've broken it into steps. If I comment out the "set mypath" line, the two MsgBox lines display the expected values. Note that this includes printing wbxx.Path. But if I leave in the "set mypath" it fails on that line.
If mypath is declared, the result is a compile time error
31821
If I omit the declaration of mypath, there is a runtime error.
31822
WHAT is going on?
How do I get the path to the current workbook?
I am still on VBA 7.1.1143. But Workbook.Path really ought to work.
Thanks, Fred Hansen