route217
asked on
Run Time Error 9 - Subscript out of Range
Hi Experts
I cannot see the wood for the trees as i am getting "Run Time Error 9 - Subscript out of Range" on the following macro....
on line Workbooks("Apples@AShow201 3.xls").Ac tivate
The above work book is open when i run the macro below.......
I cannot see the wood for the trees as i am getting "Run Time Error 9 - Subscript out of Range" on the following macro....
on line Workbooks("Apples@AShow201
The above work book is open when i run the macro below.......
Private Sub Auto_Open()
Dim dtmModifiedDate As Date
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
AddIns("Analysis ToolPak").Installed = True
Application.Workbooks.Open "\\mydocuments\XXXX2013.xls", , True
Workbooks("Apples@AShow2013.xls").Activate
dtmModifiedDate = FileDateTime("\\mydocuments\XXXX2013.xls")
Sheets("Sheet1").Unprotect
Range("LastUpdate").Value = dtmModifiedDate
With Sheet1
.Protect UserInterfaceOnly:=True
.EnableOutlining = True
End With
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
'Workbooks' is a collection and VBA only adds workbooks to that collection when they are opened from within the current workbook. It may be possible using APIs to find an already open workbook but I'm not sure how you would activate it.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
It is possible.Is that a question?
No. It's a statement of fact.
ASKER
thanks... all experts...for the excllent feedback. ..apologies I could reply back sooner.
You're welcome and I'm glad I was able to help.
Marty - MVP 2009 to 2013
Marty - MVP 2009 to 2013
Rgonzo1971:
route217:
---
Is the workbook "Apples@AShow2013.xls" open within the same instance (session) of Microsoft Excel that the code is running within?
What is the name of the workbook where the Auto_Open() event code is stored?
PS. Was your other question a "Script out of range" error, or a "Subscript out of range" error?
[ https://www.experts-exchange.com/questions/28177187/Personal-xlsb-macro-not-running-when-workbook-is-open.html ]
BFN,
fp.