ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Stopping macros running? (https://www.excelbanter.com/excel-programming/327729-stopping-macros-running.html)

Ben Vince UK

Stopping macros running?
 
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


Bob Phillips[_6_]

Stopping macros running?
 
Set xlApp.application.enableevents = false before the workbook close or the
quit.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Ben Vince UK" wrote in message
oups.com...
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




Chip Pearson

Stopping macros running?
 
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


"Ben Vince UK" wrote in message
oups.com...
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





All times are GMT +1. The time now is 08:43 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com