Run a Macro over a Closed Workbook??

J

John

I have a Macro that copies data to another Workbook. Is it possible to
execute this code without having to actually open up the second Workbook??

Thanks
 
N

Nick Cranham

John,
If you use ADO (and what you want to do is suitable for this), the workbook
is not opened in the same sense as Excel automation.

NickHK
 
J

John

Thanks for the reply Nick but I'm not sure what ADO is, I've looked it up
under Functions but can't seem to find it
 
N

Nick Cranham

John,
Active Data Objects. A way of connecting to data sources, databases, text
files, etc and Excel and performing SQL queries. You can't do any formatting
etc to the workbook, but you can update and retrieve data.

NickHK
 
B

Bob Phillips

John,

Be aware that this is not trivial, will take a degree of learning re ADO,
good workbook design, and a fair amount of code.

IMO it would be simpler just to open the workbook, do your stuff, and close
it. Pragmatism v knowledge, the choice is yours.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
N

Nick Cranham

John,
That's sound advice from Bob, (I'm not even recommending it) but if you
really do not want to open the workbook for some reason, that's about the
only route to go.

Nick
 
T

Tom Ogilvy

Depends on what you want to do. If you want to retrieve some values from a
sheet in a closed workbook, you could always have your code put a linking
formula in the appropriate cells, then replace the formulas with the
displayed values. This is generally the fastest method as well.
 
Top