View Full Version : Solved: linking with word
ashgull80
04-23-2012, 02:52 AM
hi
i was wondering if it is possible to link textboxes in a userform in excel to tables in a word document. i have read the thread which creates a table in word but i already have a sample document with tables that i need the data copied to a specific cell.
thanks
ash
Your information is rather 'limited'
If you want the value of cell F5 to be put into the first cell of the first table in the Word dcoument "G:\OF\example.doc" then use:
sub snb()
with getobject("G:\OF\example.doc")
.tables(1).cell(1,1).range.text=sheets(1).cells(5,6).value
.close -1
end with
end sub
ashgull80
04-23-2012, 04:24 AM
excelent works a treat, i changed the ceel to a userform text box and works perfect.
1 question though, how do i open the word document instead of closing it, can i also code it so it saves the word doc as a new file name?
thank you very much ash
Sub snb()
With getobject("G:\OF\example.doc")
.tables(1).cell(1,1).range.text=TextBox5.Text
.SaveAs "G:\OF\example 002.doc"
.close 0
End With
End Sub
ashgull80
04-23-2012, 06:22 AM
can i set the name for it to be saved as from a cell in table 1?
ashgull80
04-29-2012, 12:46 PM
Sub snb()
With getobject("G:\OF\example.doc")
.tables(1).cell(1,1).range.text=TextBox5.Text
.SaveAs "G:\OF\example 002.doc"
.close 0
End With
End Sub
gives me an error on
.tables(1).cell(1,1).range.text=TextBox5.Text
I have no idea what's in textbox5.
Please post your workbook.
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.