Home |
Search |
Today's Posts |
|
#1
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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
![]() |
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Entering Excel information into MS Word | Excel Discussion (Misc queries) | |||
Copying Excel object back into Excel from Word | Excel Discussion (Misc queries) | |||
Inserting Photos into Excel and linking to Word. | Excel Discussion (Misc queries) | |||
How to embed Word document into Excel and retain sizing, formatti. | Excel Discussion (Misc queries) | |||
Paste rows of numbers from Word into single Excel cell | Excel Discussion (Misc queries) |