determine how excel was opened

M

Matt Williamson

Is there any way via code to determine how Excel was opened? I want to run a
startup macro but only if Excel is opened via automation. Specifically, I'm
writing to an excel sheet from SQL server using OPENROWSET and I want to
clear the previous data first.

TIA

Matt
 
P

Peter T

Not directly, though you might be able to infer if the instance was
automated if normally you'd expect a personal.xls and one or more installed
addins to be loaded. If not present as expected would likely mean it was
originally automated (though not necessarily an longer).

The 'specific' details you gave does not give any useful information as to
why you want to know.

Regards,
Peter T
 
M

Matt Williamson

Not directly, though you might be able to infer if the instance was
automated if normally you'd expect a personal.xls and one or more
installed addins to be loaded. If not present as expected would likely
mean it was originally automated (though not necessarily an longer).

The 'specific' details you gave does not give any useful information as to
why you want to know.

I have to re-think this. OPENROWSET doesn't instantiate an instance of Excel
so I doubt any opening code would run. I'll just make a blank template and
create a copy to dump the results into.
 

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

Top