Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Mac VBA compile error - Help!

Hopefully, someone has seen this & knows a work-around - it's making me
crazy.

I'm developing a set of macros (on Win/XP) and testing them on iMacs.
When I open the workbook, I execute (from the ThisWorkbook.Private Sub
Workbook_Open() routine) a series of subroutines in our code module.
Works fine on (several) Windows platforms.

However, on (several) Macs, I get the following error:
"Compile error:
Automation error"

which opens the VBA IDE, with the header of the following routine
highlighted:

Sub MA_Repair_Links(Sheet_Name As String, Replacement_String As String,
_
wBook As Workbook, MA_Return_Code As Integer)
'
' Marketing Budget Toolkit - Repair Links after sheet import
' (c) 2006 Marketing Acumen, LLC
' Macro written Jan 2006 by Steve Knowles
'
Dim wSheet As Worksheet

Set wSheet = MA_Get_Sheet(Sheet_Name, MA_Return_Code, wBook)
wSheet.Select
wSheet.Unprotect Password:=MA_Pwd
wSheet.Cells.Replace What:="=#REF!", _
Replacement:=Replacement_String, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False

wSheet.Protect Password:=MA_Pwd, UserInterfaceOnly:=True

End Sub

Note: this subroutine is NOT executed from the Workbook_Open event.
Even more interesting (to me), I can later run the routine that calls
this module (after quitting the IDE and manually setting my global
variables), and it works fine!

I'm doing most of my testing on Microsoft Excel X for Mac® Service
Release 1 (2001), but am getting the same behaviors on other Mac
versions.

Thanks for any insights you can provide...
- Steve Knowles

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Mac VBA compile error - Help!

If you don't get an answer in this newsgroup, maybe you'll get one he
news://msnews.microsoft.com/microsof...c.office.excel

I'm confused about what you write--at the top, you say you call it from
workbook_open. At the bottom, you say you don't.

But if you do call it in the workbook_open event, I've seen posts that describe
timing issues (for a lack of a better term) that can occur.

Some people suggested something like:

Private Sub Workbook_Open()
Application.OnTime Now, "Continue_Open"
End Sub

Then in a general module:

sub Continue_Open()
'your real code here
end sub

(But I have no real idea--wintel only here <bg.)

sknowles wrote:

Hopefully, someone has seen this & knows a work-around - it's making me
crazy.

I'm developing a set of macros (on Win/XP) and testing them on iMacs.
When I open the workbook, I execute (from the ThisWorkbook.Private Sub
Workbook_Open() routine) a series of subroutines in our code module.
Works fine on (several) Windows platforms.

However, on (several) Macs, I get the following error:
"Compile error:
Automation error"

which opens the VBA IDE, with the header of the following routine
highlighted:

Sub MA_Repair_Links(Sheet_Name As String, Replacement_String As String,
_
wBook As Workbook, MA_Return_Code As Integer)
'
' Marketing Budget Toolkit - Repair Links after sheet import
' (c) 2006 Marketing Acumen, LLC
' Macro written Jan 2006 by Steve Knowles
'
Dim wSheet As Worksheet

Set wSheet = MA_Get_Sheet(Sheet_Name, MA_Return_Code, wBook)
wSheet.Select
wSheet.Unprotect Password:=MA_Pwd
wSheet.Cells.Replace What:="=#REF!", _
Replacement:=Replacement_String, LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False

wSheet.Protect Password:=MA_Pwd, UserInterfaceOnly:=True

End Sub

Note: this subroutine is NOT executed from the Workbook_Open event.
Even more interesting (to me), I can later run the routine that calls
this module (after quitting the IDE and manually setting my global
variables), and it works fine!

I'm doing most of my testing on Microsoft Excel X for Mac® Service
Release 1 (2001), but am getting the same behaviors on other Mac
versions.

Thanks for any insights you can provide...
- Steve Knowles


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Mac VBA compile error - Help!

Dave -
Thanks for the pointers - I will try both the newsgroup, and the timing
trick.

To try to clarify my confusing statement: the compile error occurs when
I open the workbook, after I click the "Enable Macros" warning, but
before any of the routines in my Workbook_Open() are executed. But I do
not actually call the MA_Repair_Links sub from that event, anyway -
it's executed only when the user selects an action from the menu, after
the workbook is open.

Thanks again for the tips; I'll let you know how it works out.
- Steve

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Mac VBA compile error - Help!

After reading your explanation, I don't think that the timing issue is the
problem.

But good luck finding, er, solving the problem.

sknowles wrote:

Dave -
Thanks for the pointers - I will try both the newsgroup, and the timing
trick.

To try to clarify my confusing statement: the compile error occurs when
I open the workbook, after I click the "Enable Macros" warning, but
before any of the routines in my Workbook_Open() are executed. But I do
not actually call the MA_Repair_Links sub from that event, anyway -
it's executed only when the user selects an action from the menu, after
the workbook is open.

Thanks again for the tips; I'll let you know how it works out.
- Steve


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
help with this error-Compile error: cant find project or library JackR Excel Discussion (Misc queries) 2 June 10th 06 09:09 PM
VBAProject name compile error, not defined at compile time Matthew Dodds Excel Programming 1 December 13th 05 07:17 PM
error message: compile error, argument not optional Pierre via OfficeKB.com Excel Programming 3 September 5th 05 03:45 PM
How do I get rid of "Compile error in hidden module" error message David Excel Discussion (Misc queries) 4 January 21st 05 11:39 PM


All times are GMT +1. The time now is 01:05 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"