Stopping macros running?

  • Thread starter Thread starter Ben Vince UK
  • Start date Start date
B

Ben Vince UK

Hi all,

I've been looking everywhere for a solution to this without any luck.
I've got an access database that opens a excel spreadsheet (via VBA)
and collects infomation about the shapes on the spreadsheet and puts
the infomation on a form in Access. All the code to do this is ok, but
i can't close down Excel afterwards. I did the usual .quit method and
set the object to nothing but it still showed in the process manager. I
was just about to give up when i found that it was crashing because
there was a routine running on the workbook_deactivate &
workbook_beforeclose events. Is there anyway to stop these from running
on shut down, without changing the original spreadsheets (i can't as
there are too many of them!) I'm using Access & Excel 97.

I wish there was a "oWb.open "c:\spreadsheet.xls" RunMacros:=False"
option!!

Thanks for your help

Ben Vince
 
Set xlApp.application.enableevents = false before the workbook close or the
quit.

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
You can turn off Excel events via the Application object.

AppExcel.EnableEvents = False
' open the workbook
AppExcel.EnableEvents = True

where AppExcel is your reference to the Excel Application object.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top