#1   Report Post  
jhilger
 
Posts: n/a
Default Word and Excel

I have an excel spreadsheet and would like to create a "button" which would
trigger a form letter (in word) to be printed with select information in the
excel file. How do I do that?
  #2   Report Post  
MrT
 
Posts: n/a
Default

You have to open vba (ALT+F11) and paste the next code :

Public Function CoppySelectionToWord()
Dim WrdAPP As Object ' Declare variable to hold the reference.
Set WrdAPP = CreateObject("Word.application") 'set variable = to word
application
Selection.Copy 'coppy the selection to clipboard
WrdAPP.Visible = True 'make word visible
WrdAPP.documents.Add 'create new document in word
WrdAPP.Selection.Paste 'paste the selection in word
Set WrdAPP = Nothing 'release the variable
End Function

Then in excel itself you link a button to this code.
problem solved ;o)

"jhilger" wrote:

I have an excel spreadsheet and would like to create a "button" which would
trigger a form letter (in word) to be printed with select information in the
excel file. How do I do that?

  #3   Report Post  
jhilger
 
Posts: n/a
Default

Thank you for your assistance. When I hit alt + F11, it comes up with a
blank form. What do I bring up to paste this into. I am a novice and have
not used VB before.

Thanks.

"MrT" wrote:

You have to open vba (ALT+F11) and paste the next code :

Public Function CoppySelectionToWord()
Dim WrdAPP As Object ' Declare variable to hold the reference.
Set WrdAPP = CreateObject("Word.application") 'set variable = to word
application
Selection.Copy 'coppy the selection to clipboard
WrdAPP.Visible = True 'make word visible
WrdAPP.documents.Add 'create new document in word
WrdAPP.Selection.Paste 'paste the selection in word
Set WrdAPP = Nothing 'release the variable
End Function

Then in excel itself you link a button to this code.
problem solved ;o)

"jhilger" wrote:

I have an excel spreadsheet and would like to create a "button" which would
trigger a form letter (in word) to be printed with select information in the
excel file. How do I do that?

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
Entering Excel information into MS Word dwalsh77 Excel Discussion (Misc queries) 0 April 8th 05 05:29 PM
Copying Excel object back into Excel from Word Regina Excel Discussion (Misc queries) 2 March 29th 05 06:57 PM
Inserting Photos into Excel and linking to Word. Uploading Photos Excel Discussion (Misc queries) 0 March 17th 05 08:05 PM
How to embed Word document into Excel and retain sizing, formatti. Kent Excel Discussion (Misc queries) 0 February 2nd 05 07:37 PM
Paste rows of numbers from Word into single Excel cell BecG Excel Discussion (Misc queries) 1 December 8th 04 04:55 PM


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