ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run a Macro over a Closed Workbook?? (https://www.excelbanter.com/excel-programming/291979-run-macro-over-closed-workbook.html)

John[_78_]

Run a Macro over a Closed Workbook??
 
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



Nick Cranham

Run a Macro over a Closed Workbook??
 
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

"John" wrote in message
...
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





John[_78_]

Run a Macro over a Closed Workbook??
 
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


"Nick Cranham" wrote in message
...
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

"John" wrote in message
...
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







Nick Cranham

Run a Macro over a Closed Workbook??
 
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

"John" wrote in message
...
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


"Nick Cranham" wrote in message
...
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

"John" wrote in message
...
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









Bob Phillips[_6_]

Run a Macro over a Closed Workbook??
 
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)

"John" wrote in message
...
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


"Nick Cranham" wrote in message
...
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

"John" wrote in message
...
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









Nick Cranham

Run a Macro over a Closed Workbook??
 
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

"Bob Phillips" wrote in message
...
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)

"John" wrote in message
...
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


"Nick Cranham" wrote in message
...
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

"John" wrote in message
...
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











Tom Ogilvy

Run a Macro over a Closed Workbook??
 
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.

--
Regards,
Tom Ogilvy


"Nick Cranham" wrote in message
...
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

"Bob Phillips" wrote in message
...
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)

"John" wrote in message
...
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


"Nick Cranham" wrote in message
...
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

"John" wrote in message
...
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













John[_78_]

Run a Macro over a Closed Workbook??
 
I think pragmatism will win out on this occasion Bob.

Thanks


"Bob Phillips" wrote in message
...
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)

"John" wrote in message
...
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


"Nick Cranham" wrote in message
...
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

"John" wrote in message
...
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











Bob Phillips[_6_]

Run a Macro over a Closed Workbook??
 
Understandable<G

Bob

"John" wrote in message
...
I think pragmatism will win out on this occasion Bob.

Thanks


"Bob Phillips" wrote in message
...
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)





All times are GMT +1. The time now is 05:18 AM.

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