Help! I Can't Disable all Excel Warnings

presuming_ed

Registered User.
Local time
Today, 01:53
Joined
May 6, 2003
Messages
23
Hello,

I have some VBA code that is starting an instance of Excel, and running an excel macro against a txt file. It works fine, except as part of the macro I'm merging multiple cells in the same row together. Each time I attempt to do this I get an Excel warning message stating that only the data in the leftmost cell will be kept.

I've disabled warnings in my code after starting excel as follows:

' Start an Excel session
Set objxl = New Excel.Application
objxl.Visible = False
Workbooks.Open filename:="c:\stock_tracker.xls"

' Turn warnings off
DoCmd.SetWarnings False

' Excel Macro Code
With objxlwrksht
Rows("1:1").Select
Selection.Insert Shift:=xlDown

etc....


Is there anything else I need to code to disable all excel warnings?

Thanks.
 
I would relocate the Set Warnings within the macro in excel. Place it as the first line and see if you still get the msg.
 
try

objXL.Application.displayalerts = False
 

Users who are viewing this thread

Back
Top Bottom