Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 128
Default Button needed in worksheet to invoke word doc with linked values

I have a worksheet in excel.
I also have a word document (saved in the same directory), which has links
with the details on this worksheet.
I have added a command button with the intention that the user will be able
to click on the button and invoke the word document.
What code do I need to use in order to do this, or is there another way
around this?
Any help appreciated. Thanks in advance.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 273
Default Button needed in worksheet to invoke word doc with linked values

First, you have to establish a reference to the Word 11.0 Object library from
the Visual Basic Editor (Tools/References). Assuming the button on the
worksheet is named btn_Run and the Word document is named Test.doc, the
following code will open the Word document in the same location as the
worksheet.

Private Sub btn_Run_Click()
Dim WordDoc As Word.document
Dim path As String

'The "path" variable is the location of the workbook

path = Application.Workbooks("TestWKB.xls").path

'Open Word document
Set WordDoc = Word.documents.Open(path & "\test.doc")

'Close Word document
WordDoc.Close

End Sub




"Sarah (OGI)" wrote:

I have a worksheet in excel.
I also have a word document (saved in the same directory), which has links
with the details on this worksheet.
I have added a command button with the intention that the user will be able
to click on the button and invoke the word document.
What code do I need to use in order to do this, or is there another way
around this?
Any help appreciated. Thanks in advance.

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 get userform Cancel button to invoke Exit Sub in calling macro? Craig Remillard New Users to Excel 1 November 19th 09 03:55 AM
Help needed in updating excel worksheet values sadat Excel Worksheet Functions 1 June 7th 07 06:27 AM
How to invoke a user form from a custom button on the menu bar JLGWhiz Excel Programming 0 January 20th 07 03:32 AM
Importing Excel Worksheet into word... help needed! EGNX Flyer Excel Discussion (Misc queries) 5 October 27th 06 04:52 PM
Turning Excel Worksheet Linked to Word Document into Report Templa Jordan Rose Excel Programming 0 September 19th 05 06:19 PM


All times are GMT +1. The time now is 02:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"