Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 47
Default How to copy a sheet from a workbook to another in different folder

Happy Holloween!

I'd like to copy in VBA a sheet from one workbook to another workbook that
is located in different folder.

Thanks!

Kurt

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default How to copy a sheet from a workbook to another in different folder

This also copies a range from one book to the other but it should work for
you with a little tweaking...

Sub Test()
Dim wbkSource As Workbook
Dim wbkDestination As Workbook
Dim wksSource As Worksheet
Dim wksDestination As Worksheet
Dim rngSource As Range
Dim rngDestination As Range

'Set your source
Set wbkSource = ThisWorkbook
Set wksSource = wbkSource.Sheets("Sheet1")
Set rngSource = wksSource.Cells

'Set your destination
On Error GoTo OpenBook
Set wbkDestination = Workbooks("ThatBook.xls")
On Error GoTo 0
Set wksDestination = wbkDestination.Sheets("Sheet1")
Set rngDestination = wksDestination.Range("A1")

'You now have all of your souce and destination objects

wksSource.Copy wksDestination 'Copy the sheet
rngSource.Copy rngDestination 'Copy a range

Exit Sub

OpenBook:
Set wbkDestination = Workbooks.Open("C:\Thatbook.xls")
Resume Next
Exit Sub

End Sub

--
HTH...

Jim Thomlinson


"kurt" wrote:

Happy Holloween!

I'd like to copy in VBA a sheet from one workbook to another workbook that
is located in different folder.

Thanks!

Kurt

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
How to Copy Excel Workbook - Hyperlinks - Folder of Photos - to CD nokomis Excel Worksheet Functions 1 February 9th 09 04:31 AM
How to Copy Excel Workbook - Hyperlinks - Folder of Photos - to CD nokomis Excel Worksheet Functions 0 February 8th 09 11:56 PM
move a sheet out of my workbook and place in another folder? trishb123 Excel Discussion (Misc queries) 3 January 10th 07 04:14 PM
Open and copy all workbook sheets in a folder to a master file [email protected] Excel Discussion (Misc queries) 0 November 2nd 06 04:29 PM
HELP: Link all values in a workbook under same folder on one sheet m Excel Programming 2 July 1st 04 10:53 AM


All times are GMT +1. The time now is 05:23 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"