Chris Williamson
Board Regular
- Joined
- Oct 16, 2010
- Messages
- 83
Hi guys, is it possible to take information from cells in an excel worksheet and put those values in a word document at a click of a button?
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
This little macro code shown below opens up a word template as a document, the document itself is a simple form… there are several ‘Text Form Field’ boxes in the word template so when the file is in the protected mode - you just need to press the TAB key to move to the next field.
<o></o>
The properties for these ‘Text Form Field’ boxes have ‘Bookmarks’ associated with them, for example ‘Text1’.
<o></o>
How do you take the value from cell ‘A1’ in excel and put that value in the bookmark name ‘Text1’ in this new word document when you click a button?<o></o>
<o></o>
Sub Excel_To_Word_Test()<o></o>
<o></o>
<o></o>
<o></o>
Thank you.
<o></o>
<?xml:namespace prefix = o ns = "urn:schemas-microsoft-comfficeffice" /><o></o>
This little macro code shown below opens up a word template as a document, the document itself is a simple form… there are several ‘Text Form Field’ boxes in the word template so when the file is in the protected mode - you just need to press the TAB key to move to the next field.
<o></o>
The properties for these ‘Text Form Field’ boxes have ‘Bookmarks’ associated with them, for example ‘Text1’.
<o></o>
How do you take the value from cell ‘A1’ in excel and put that value in the bookmark name ‘Text1’ in this new word document when you click a button?<o></o>
<o></o>
Sub Excel_To_Word_Test()<o></o>
<o></o>
Code:
If [Check Box 1].Value = 1 Then<o:p></o:p>
Dim objWord As Object<o:p></o:p>
Set objWord = CreateObject("Word.Application")<o:p></o:p>
objWord.Visible = True<o:p></o:p>
objWord.Documents.Add "\**File Location**\Word.dot"<o:p></o:p>
End If<o:p></o:p>
<o:p></o:p>
End Sub
<o></o>
Thank you.
<o></o>