Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How can I copy a string from my exel document to a text box on a form in a
word document? I can open the word document with the following: Dim appWD As Word.Application Set appWD = CreateObject("Word.Application") appWD.Documents.Open Filename:=strPath & "\Letter.dot" I just dont know how to refence the text box to then make it equal to the string. Thanks for your help in advance. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
In excel first add reference to "Mocrosoft Word xx.x Object Library"
Add following code below the last line of your code and see. '1. Referring by index number: First find out the inderx number of the text box. if it is the only Shape in document it will be 1. ' Replace (n) below with the index number. appWD.ActiveDocument.Shapes(n).TextFrame.TextRange .Text = "Was the reference to text box success?" appWD.ActiveDocument.SaveAs ("C:\letter1.doc") appWD.ActiveDocument.Close Exit sub '2: Referring by name: First find out the name of the text box object - which Typically will be "Text Box n". 'Replace n with the correct number. appWD.ActiveDocument.Shapes("Text Box n").TextFrame.TextRange.Text = "Was the reference to text box success?" appWD.ActiveDocument.SaveAs ("C:\letter1.doc") appWD.ActiveDocument.Close Exit sub Sharad "Ben" wrote in message ... How can I copy a string from my exel document to a text box on a form in a word document? I can open the word document with the following: Dim appWD As Word.Application Set appWD = CreateObject("Word.Application") appWD.Documents.Open Filename:=strPath & "\Letter.dot" I just dont know how to refence the text box to then make it equal to the string. Thanks for your help in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Attach Word document to a text box in Excel | Excel Discussion (Misc queries) | |||
Attach Word document to a text box in Excel | Excel Discussion (Misc queries) | |||
Attach Word document to a text box in Excel | Excel Discussion (Misc queries) | |||
moving text from a word document to excel | New Users to Excel | |||
Accessing Word from Excel | Excel Programming |