Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Copying an Excel sheet from a closed xls document into the current doc

Status
Not open for further replies.

VBAguy22

IS-IT--Management
Aug 5, 2003
180
CA
Hi there,
Using VBA i need to be able to copy a sheet, called CopyMe, from a closed document, say C:\Source.xls, into the current document (the open document) say C:\Target.xls.
I assume I will have to open source.xls in the background or something to that extend. If you got any code cuts they would be greatly appreciated!

Alex
 

Hi,

take a look at MS Query via menu item Data/Get External Data/New Database Query -- Excel Files -- C:\Source.xls -- THE WORKSHEET in C:\Source.xls.....

Skip,

[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue]
 
My sheet is not really a table so the query doesnt find it. I just need a way to say "Pick up SheetX from C:\Source.xls, make a copy of it into C:\Target.xls
 

Code:
wbSource.WhatSheet.Cells.Copy Activesheet.[A1]

Skip,

[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top