View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Troubled User Troubled User is offline
external usenet poster
 
Posts: 85
Default Re-Post: Embedded Word File

Thank you VERY much. I will try a little later tonight and let you know if I
have any problems.

"Joel" wrote:

I saw youor earlier posting but didn't have time to respond. This code
should work. Change "ABC" to read the data from your text box.

Sub gettable()

For Each obj In ActiveSheet.OLEObjects
If InStr(obj.progID, "Word.Document") 0 Then
'open word document
obj.Activate

Set WordDoc = obj.Object.Application.ActiveDocument
MyRow = 2
MyCol = 2
For Each tbl In WordDoc.tables
tbl.cell(MyRow, MyCol).Range.Text = "ABC"
Next tbl

End If

Next obj

End Sub


"Troubled User" wrote:

I have an Excel File that has an embedded Word File in it. The embedded Word
file contains a table with say 5 rows and 3 columns.

Additionally, in this file I have a text box (Textbox1). I am trying to
copy the contents of Textbox1 to Row 2, column 2 of the table within the
embedded Word file.

I have done a fair amount of copying between Textboxes/cells and Textbox to
Textbox, but I don't know how to reference this table and location in the
embedded Word file.

Any help is very appreciated.