![]() |
Performing code without opening the Workbook
The below working code opens the workbook and pastes cells as links from
another workbook. How can I make the below operation work without having to actually open the workbook located in '"Workbooks.Open Worksheets(4).Range("A6").Value"? Workbooks.Open Worksheets(4).Range("A6").Value Range("A1").Select ActiveSheet.Paste Link:=True Thank you Todd Huttenstine |
Performing code without opening the Workbook
Hi Todd, :-)
You can use Application.ExecuteExcel4Macro, something like.. Code: -------------------- Sub Test1() Dim strTarget As String strTarget = "'" & "CHANGE HERE TO FULL PATH to Book2.xls" & "\[Book2.xls]Sheet4'!R6C1" Selection.Value = Application.ExecuteExcel4Macro(strTarget) End Sub -------------------- --- Message posted from http://www.ExcelForum.com/ |
Performing code without opening the Workbook
Hi Todd,
If you want a value from closed workbook then try this, Sub Test() ActiveCell.Formula = "='c:\mypath\[mywbname.xls]mysheetname'!a1" 'to remove link convert it to value ActiveCell.Value = ActiveCell.Value End Sub Regards, Shah Shailesh http://members.lycos.co.uk/shahweb/ *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
All times are GMT +1. The time now is 06:07 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com