Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default 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


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

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 114
Default 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!
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 do I stop blank workbook from opening when opening an existing kjg Excel Discussion (Misc queries) 3 February 12th 10 09:36 PM
Code for opening a workbook at a specific time!?! mike_vr Excel Discussion (Misc queries) 2 June 5th 07 04:55 PM
How to make the opening of a workbook conditional upon the opening of another workbook Marcello do Guzman Excel Programming 1 December 16th 03 06:09 AM
How to make opening of workbook conditional of opening of another workbook turk5555[_2_] Excel Programming 2 December 15th 03 11:07 PM
Code for Opening a Closed Workbook scrabtree23[_2_] Excel Programming 3 November 11th 03 03:48 PM


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