Solved

VBA Stop other macros running when opening linked Excel file

Posted on 2006-06-12
3
325 Views
Last Modified: 2012-06-21
Hi,

I am having a problem with macros running in an excel file when I open it in the background to update linked data in my word tables.  I am aware that you can turn macros off in Excel by using the Application.EnableEvents = False command but do not know how to fit this in with my current Open Excel File command.  Any Ideas?

Below is the line that I am currently using in the opening of the excel file

Set mobjXLWorkBook = mobjXLApp.Workbooks.Open(FileName:=strPath, UpdateLinks:=False, ReadOnly:=blnReadOnly)
0
Comment
Question by:wobbled
  • 2
3 Comments
 
LVL 76

Accepted Solution

by:
GrahamSkan earned 250 total points
ID: 16887084
It's a shame that that method isn't availble to the Word Application as well.

However, it would seem logical to try:

mobjXLApp..EnableEvents = False
Set mobjXLWorkBook = mobjXLApp.Workbooks.Open(FileName:=strPath, UpdateLinks:=False, ReadOnly:=blnReadOnly)
0
 
LVL 17

Author Comment

by:wobbled
ID: 16901000
I agree that Word would benifit from such a method.

Did the job fine

Thanks

W
0
 
LVL 76

Expert Comment

by:GrahamSkan
ID: 16901057
Thanks. I've just noticed my error (two dots instead of one). Sorry about that.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This is written from a 'VBA for MS Word' perspective, but I am sure it applies to most other MS Office components where VBA is used.  One thing that really bugs me is slow code, ESPECIALLY when it's mine!  In programming there are so many ways to…
This article describes how to use the Send to Mail Recipient command. The instructions apply generally to Office 2007 and later versions, but Microsoft® Word 2013 was used for the specific steps and figures.  What is Send to Mail Recipient? Send…
This video walks the viewer through the process of creating an MLA formatted document, as well as a bibliography with citations.
This video shows where to find the word count, how to display it, and what it breaks down to in Microsoft Word.

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now