Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Enable macros when opening Excel .xls from VB

Status
Not open for further replies.

UBfoolin

Programmer
Nov 29, 2001
32
US
My app needs to import orders from Excel spreadsheets. There may be 50 .xls files to open at a time. Then I pull the data out and put it into our system.

From VB, can I "click" the Enable Macros button on the Excel dialog box automatically? I really don't care if macros run or not but I cannot have my user babysitting the import of 50 files just to reply to that dialog box.

What can I do? I am currently opening the .xls with GetObject(). All the processing works fine once the .xls has been opened.

All helps and tips are appreciated!
 


Hi,

Could you use a QUERY approch instead of opening each workbook? If the data is in tabular format on each sheet, then you could accomplish this with a simple query.

Just change the connect string on the fly and the SQL string and you've got all your data.

Skip,

[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue]
 
Thank you for taking the time to reply!

I cannot use a query. The data is not tabular.

I did find that if you are running XP SP2, you can use Application.AutomationSecurity = msoAutomationSecurityForceDisable and the app will not get the dialog box.

Alas, we are NOT running SP2!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top