ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy range from closed file (https://www.excelbanter.com/excel-programming/325399-copy-range-closed-file.html)

nc[_2_]

Copy range from closed file
 
Hi

Can one copy a range from a closed file and paste in an
open one?

Thanks.

OJ[_2_]

Copy range from closed file
 
Hi,
there are a couple of ways to do this. One way is to use an
ExecuteExcel4Macro with the Cell.Get method. Another, if your data is
set out in a DB format is to use ADO. Also, you can always link the
cells and update links!!

Hth,
O


Ron de Bruin

Copy range from closed file
 
Hi nc

Try this example
http://www.rondebruin.nl/ado.htm

Or other ways on my tips page
http://www.rondebruin.nl/tips.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl



"nc" wrote in message ...
Hi

Can one copy a range from a closed file and paste in an
open one?

Thanks.




OJ[_2_]

Copy range from closed file
 
Hi Ron,
On your example you use this line
' Check to make sure we received data and copy the data
If Not rsData.EOF Then

Is this reliable? I have always used...

If Not rsData.BOF then rsData.MoveFirst....

OJ


Ron de Bruin

Copy range from closed file
 
Hi OJ

I don't use it very much myself and Rob bovey helped me make this example.
I have never have problems with it but you good be right.
Maybe a ADO expert can tell us ?

Ron


--
Regards Ron de Bruin
http://www.rondebruin.nl



"OJ" wrote in message ups.com...
Hi Ron,
On your example you use this line
' Check to make sure we received data and copy the data
If Not rsData.EOF Then

Is this reliable? I have always used...

If Not rsData.BOF then rsData.MoveFirst....

OJ




Jamie Collins

Copy range from closed file
 

Ron de Bruin wrote:
Is this reliable? I have always used...

If Not rsData.BOF then rsData.MoveFirst....

I don't use it very much myself and Rob bovey helped me make this

example.
I have never have problems with it but you good be right.
Maybe a ADO expert can tell us ?


I lieu of an ADO expert... When opening an ADO recordset the position
will either be at row 1 (the equivalent of MoveFirst) or at EOF is
there are no rows. DAO behaves slightly differently from ADO e.g. in
DAO you have to MoveLast to get an accurate RecordCount but it's always
reliable in ADO. Perhaps OJ's code is a DAO hangover?

Jamie.

--


Ron de Bruin

Copy range from closed file
 
Thanks Jamie


--
Regards Ron de Bruin
http://www.rondebruin.nl



"Jamie Collins" wrote in message oups.com...

Ron de Bruin wrote:
Is this reliable? I have always used...

If Not rsData.BOF then rsData.MoveFirst....

I don't use it very much myself and Rob bovey helped me make this

example.
I have never have problems with it but you good be right.
Maybe a ADO expert can tell us ?


I lieu of an ADO expert... When opening an ADO recordset the position
will either be at row 1 (the equivalent of MoveFirst) or at EOF is
there are no rows. DAO behaves slightly differently from ADO e.g. in
DAO you have to MoveLast to get an accurate RecordCount but it's always
reliable in ADO. Perhaps OJ's code is a DAO hangover?

Jamie.

--




nc[_2_]

Copy range from closed file
 
Thanks.


-----Original Message-----
Hi nc

Try this example
http://www.rondebruin.nl/ado.htm

Or other ways on my tips page
http://www.rondebruin.nl/tips.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl



"nc" wrote in

message ...
Hi

Can one copy a range from a closed file and paste in an
open one?

Thanks.



.


Peter T

Copy range from closed file
 
Hi Ron,

Thanks for your providing your ADO example. You specified setting a
reference to
Microsoft ActiveX Data Objects 2.5 library
msado25. does not exist on my Win 98 machine. I think it was first shipped
with Win2000. However changing the reference to version 1.5 and your example
works fine.

Don't suppose many still use Win98 - but just in case!

Regards,
Peter T

"Ron de Bruin" wrote in message
...
Hi nc

Try this example
http://www.rondebruin.nl/ado.htm

Or other ways on my tips page
http://www.rondebruin.nl/tips.htm

--
Regards Ron de Bruin
http://www.rondebruin.nl



"nc" wrote in message

...
Hi

Can one copy a range from a closed file and paste in an
open one?

Thanks.






Jamie Collins

Copy range from closed file
 

Peter T wrote:
Thanks for your providing your ADO example. You specified setting a
reference to
Microsoft ActiveX Data Objects 2.5 library
msado25. does not exist on my Win 98 machine. I think it was first

shipped
with Win2000. However changing the reference to version 1.5 and your

example
works fine.


Version 1.5 is extremely aged. The latest version MDAC 2.8 can run in
Win98 and is available as download (including a redistributable):

http://msdn.microsoft.com/data/mdac/default.aspx

Jamie.

--


Ron de Bruin

Copy range from closed file
 
I add this note to my webpage Jamie

--
Regards Ron de Bruin
http://www.rondebruin.nl



"Jamie Collins" wrote in message oups.com...

Peter T wrote:
Thanks for your providing your ADO example. You specified setting a
reference to
Microsoft ActiveX Data Objects 2.5 library
msado25. does not exist on my Win 98 machine. I think it was first

shipped
with Win2000. However changing the reference to version 1.5 and your

example
works fine.


Version 1.5 is extremely aged. The latest version MDAC 2.8 can run in
Win98 and is available as download (including a redistributable):

http://msdn.microsoft.com/data/mdac/default.aspx

Jamie.

--




Peter T

Copy range from closed file
 
Jamie - thanks for the tip but.

Version 1.5 is extremely aged. The latest version MDAC 2.8 can run in
Win98 and is available as download (including a redistributable):

http://msdn.microsoft.com/data/mdac/default.aspx


I downloaded MDAC 2.8 / Mdac_typ.exe and ran the setup which did the usual.
I had previously existed all programs and accepted the prompt to restart my
system.

Windows would not exit - Ctrl Alt Delete showed just the following remaining
from the setup app:
Dasetup
Mdac-typ

I did "End task" for each followed by total crash!!!!

Restarted manually and Windows restored a backup of my registry (years since
it's needed to do that).

Sigh of relief as all appears OK. Loaded Ron's file and now it has the
previously missing reference to MADO 2.5 in place. His routines work fine
(as they did with v 2.1).

Curiously though I cannot see any references in the list to v2.8. Possibly
because Windows restored a backup registry.

Regards,
Peter T

PS, Prior to the setup I had downloaded and ran "Componant Checker" as
recommended on the download page, to inform me of I'm not quite sure what!




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

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