Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Problem with multiple Auto_Open Macro's

Anyway, I tried your suggestion and it seems to work! However, I figured
out that I also have to make sure that the names of the Excel Files
don't contain a "-", because then the code you suggested doesn't work
(the AUTO_OPEN macro is not found).


Where workbook names include dash's, spaces and some other characters, for
many operations the name needs to be embraced with apostrophes. Working with
Tom's code, try changing the line:

Application.Run mybook.Name & "!Auto_Open"
to
Application.Run Chr(39) & mybook.Name & "'!Auto_Open"

It won't do any harm to include the apostrophes even if not required.

Regards,
Peter T

"BuZzzy FF" wrote in message
...
Hello Tom,

It seems our messages crossed somehow (I'm sorry, it's probably me being
completely new on this kind of discussion forums...)

Anyway, I tried your suggestion and it seems to work! However, I figured
out that I also have to make sure that the names of the Excel Files
don't contain a "-", because then the code you suggested doesn't work
(the AUTO_OPEN macro is not found).

Conclusion:
I have 2 solutions for the problem now:

1) Use the object method like Mr. Naik suggested and use the
RunAutoMacros xlAutoOpen statement like I did originally, but insert
also dummy calls since apparently only the 1st, 3th, 5th etc... call are
succesful (the others are just skipped)

2) Use the Object Method like Mr. Ogilvy suggested, but make sure that
the file names of the Excel files don't contain a "-".

Thanks for your help!

kind regards,

Filip Henderieckx

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Problem with multiple Auto_Open Macro's

Hello Peter,

Thanks for your help: This works.

Regards,

Filip

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Problem with multiple Auto_Open Macro's

You're welcome, but it is of course Tom's suggestion and code that works for
you. My bit was trivial, to adapt to your particular needs. I imagine Tom
would have told you something similar on his return.

Regards,
Peter T

"BuZzzy FF" wrote in message
...
Hello Peter,

Thanks for your help: This works.

Regards,

Filip

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Problem with multiple Auto_Open Macro's

Hi All,

Hope some of you are still around!
I tried using this as well but got an error.

-----------------------------------------------------CODE
Sub OpenWorkbooks()
Dim myBook As Workbook

Set myBook = Workbooks.Open(Filename:="C:\Documents and
Settings\kempdav1\My Documents\FBR\FBR Report v5 7075005.xls")
With myBook
Application.Run myBook.Name & "!Auto_Open"
.Close SaveChanges:=True
End With

Set myBook = Workbooks.Open(Filename:="C:\Documents and
Settings\kempdav1\My Documents\FBR\FBR Report v5 7051008.xls")
With myBook
Application.Run myBook.Name & "!Auto_Open"
.Close SaveChanges:=True
End With

Set myBook = Nothing
End Sub

--------------------------------------------------ENDCODE

I get the error:- run time error 1004
The macro 'FBR Report v5 7075005.xls!Auto_Open' cannot be found.

I am not big on coding or excel so its probably something obvious, any
ideas would be much appeciated.

Many thanks,

David

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
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
How to run Multiple Macro's in Worksheet? Ben Dummar Excel Discussion (Misc queries) 6 May 25th 06 05:16 AM
Hide Macro's in Toolbar / Macro's list sparx Excel Discussion (Misc queries) 2 May 6th 06 08:53 PM
macro's problem gerry405 Excel Discussion (Misc queries) 7 October 31st 05 01:16 PM
How do you assign macro's to new menu with buttons on Auto_open? Simon Lloyd[_514_] Excel Programming 6 June 27th 04 12:14 PM
How do you assign macro's to new menu with buttons on Auto_open? Simon Lloyd[_502_] Excel Programming 2 June 23rd 04 11:19 PM


All times are GMT +1. The time now is 04:41 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"