Michael has attended:
No courses
Problem with Workbook.activate command
I am having a problem with using the workbook.activate command across different users in my office. We are all running the same version of excel, but on some computers the code errors, as an example consider a workbook called "Example" that I would like to select as part of the program, on the problem computers this errors out at the line:
Workbooks("Example").activate
the error message stipulates that basically it doesn't understand the command. on the problem computers I ahve done the obvious things such as install the VBA and VBA analysis toolpacks, and this has not resolved the issue.
When I comment out the problem line the program runs without an issue, can anyone help me with this?
RE: Problem with Workbook.activate command
Thank you for your question.
One thing that might be causing the error is the missing extension from the workbook name. Do the PCs having problems have autosave turned on? Saving for some reason adds the extension to the name. So the following would work after a save
Workbooks("Example.xls").Activate
If that is not the issue then you possible could at a point when you know Example is the activeworkbook, for example when you open or create it and use the following
Dim wkExample as Workbook
Set wkExample = ActiveWorkbook
And then later when you need to activate it.
wkExample.Activate
I hope that helps
Laura GB