Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Copy range from closed file

Hi

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

Thanks.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default 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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default 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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 593
Default 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.

--

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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.

--



  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default 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.



.

  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 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.





  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 593
Default 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.

--



  #11   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default 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.

--



  #12   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 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!


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Copy a range from closed workbooks (ADO) nc Excel Discussion (Misc queries) 3 October 17th 05 06:02 PM
summing a range in a closed file mark Excel Programming 0 October 15th 04 12:12 AM
How to copy a range to a closed workbook max Excel Programming 1 July 16th 04 11:13 AM
VBA - on a button event, open another closed file, post changes, close file Fio Excel Programming 0 March 1st 04 01:08 PM
Problem with named Range in ADO extract from Closed Excel File Dave Bash Excel Programming 1 December 23rd 03 09:10 AM


All times are GMT +1. The time now is 10:18 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"