Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to write value in a word table

Status
Not open for further replies.

sal21

Programmer
Apr 26, 2004
425
IT
I need to write a value (in red color) in the 2 tables of word doc?

note:
I just have a code to open a doc with a visible option.

part of cdoe:

....

Dim APP As Object
Dim DOC As Object
Set APP = CreateObject("WORD.Application")
APP.Visible = True

Set DOC = APP.documents.Open("C:\Lavori_Vb6\HOTEL\Fattura.doc")

....

 
I usually place a Bookmark in my document where I want to place my text and do:
[tt]
DOC.Bookmarks("bkmMyBookMark").Range.Text = "Any text I want"[/tt]

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
What is the source of the data that you are using to fill in the doc?

database? VB Array? Set of variables?
 
If not using bookmarks, putting text in a specific cell of a table would be something like this:
[tt]worddoc.Tables(1).cell(1, 1).Range.text = "Any text " & stVariableText[/tt]

Above is an example of combining hard coded text with variable text, if doing variables, remove hard coded text.

Cells are from left to right starting at 1. Looks like you may have two tables? If so, would need to identify the table number for each. So [tt]BANCA X - Via[/tt] would be .cell(4,2) for the 4th row and 2nd col.
 
Then Andy's bookmark solution is probably your best bet. Have you tried it?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top