ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   copy worksheet without opening the workbook (https://www.excelbanter.com/excel-programming/409468-copy-worksheet-without-opening-workbook.html)

Ben

copy worksheet without opening the workbook
 
Hi all,

I would like ask if there's a way to copy a worksheet from a workbook A into
workbook B, without actually opening workbook A?

Thanks,

Ben

--


John

copy worksheet without opening the workbook
 
you can do it using formula.
try following:

Sub GetData()
Dim mydata As String
'data location & range to copy
mydata = "='C:\[NewBook.xls]Sheet1'!$B$2:F12" '<< change as required

'link to worksheet
With Worksheets(1).Range("B2:F12") '<< change as required
.Formula = mydata

'convert formula to text
.Copy
.PasteSpecial Paste:=xlPasteValues
End With
Application.CutCopyMode = False
End Sub

--
jb


"Ben" wrote:

Hi all,

I would like ask if there's a way to copy a worksheet from a workbook A into
workbook B, without actually opening workbook A?

Thanks,

Ben

--


JLGWhiz

copy worksheet without opening the workbook
 
See this site:

http://www.rondebruin.nl/ado.htm

"Ben" wrote:

Hi all,

I would like ask if there's a way to copy a worksheet from a workbook A into
workbook B, without actually opening workbook A?

Thanks,

Ben

--



All times are GMT +1. The time now is 04:38 AM.

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