problem workbookactivate command
Microsoft Office TrainingThe UK's Number 1 for Microsoft Office Training Sitemap add this page to your favourites/bookmarksBookmark page
 
view a printable version of this pagePrintable version
Plus One Google
Customer: Sign in
Delegate: Sign in
Trainer: Log in

Forum home » Delegate support and help forum » Microsoft VBA Training and help » Problem with Workbook.activate command

Problem with Workbook.activate command

resolvedResolved · Medium Priority · Version 2003

replyReplyThu 15 Jan 2009, 14:24Delegate Michael said...

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?

For upcoming training course dates see: Pricing & availability

replyReplyWed 21 Jan 2009, 14:44Trainer Laura said...

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

replyReplyThu 22 Jan 2009, 09:18Delegate Michael said...

RE: Problem with Workbook.activate command

Thanks Laura,

You were right it was a problem over the extension not being listed, I have made the necessary adjustments and now my code works perfectly.

Thanks again

Michael

 

 

Please browse our web site to find out more about
access vba introduction and other Microsoft training courses.

Vba tip:

Empty The Clipboard with CutCopyMode

After each Copy/Paste operation in VBA, you should use the following line of code to empty the clipboard. This ensures that the computer memory doesn't overload:

ActiveSheet.Paste
Application.CutCopyMode = False

View all VBA hints and tips

forum postHow?

» Forum post: Embedded object


Rate this page:
2.2/5 (213 votes cast)
Accredited Training Provider: Institute of IT Training Institute of Leadership and Management - Certified Courses
Microsoft Certified Partner
Security Seal verified by visa, mastercard securecard

Mini sitemap. These are the main areas of our web site. Full sitemap.

Management training

Professional Skills courses
Project Management Course London
Project Management Courses London
Project Management Training London
Project Management Training
Project Seminar
Project Seminars
Time Management Course London
Time Management London
Time Management Courses London
Time Management Training London
Introduction to Finance course
Assertiveness Skills course
Effective Communications Skills training
Presentation Skills London

Training Formats

Public scheduled courses
On-site training
Closed company courses

Consultancy
Application Development

Blogs

Excel Training
MS Project Training
Microsoft Training Blog

Version differences

Office 2010 vs 2007
MS Project version differences

Training Information

London Computer Training
Computer Training London
Docklands Training Courses
Docklands Training London

Training venues London
Client list
FAQ
Pricing and availability
Course details / Syllabus

Training Articles
Training Information

Microsoft training

Microsoft Office training
& IT Applications

Microsoft Project training
Microsoft Outlook training
Microsoft Powerpoint training
Microsoft Word training
MS Project courses
MS Project training
Outlook courses
PowerPoint courses
PowerPoint training
VBA courses
Word courses
Microsoft.training
(more...)

Excel Training

Excel courses
Excel Training Courses Medway
Autonumber in Excel
Microsoft Excel training
Basic Excel Courses
Basic Excel Course
Basic Excel Training

Interested in MS Access training?

Access courses
Microsoft Access training
Microsoft access courses
Microsoft training access course
Microsoft+access+training
Access courses in london

Training provider

Training providers
IT training companies
IT training providers
Management Training providers
Management Training provider

Event history, feedback results
Events in 2012 · 2011 · 2010 · More

See also

Crystal Reports training