insertdatetime?

E

Eric

Why I cannot run the following code:
tb1.cell(1,4).range.insertdatetime datetimeformat:="MM/dd/yy"

I want to print current date in one cell of table.
Thanks.
 
H

Helmut Weber

Hi Eric:
have a look at this:
Dim oTbl As Table
Dim oRng As Range
Set oTbl = ActiveDocument.Tables(1)
Set oRng = oTbl.Cell(1, 1).Range
oRng.Collapse
oRng.InsertDateTime datetimeformat:="MM/dd/yy"
Your approach fails, because your range
includes end of cell mark, as far as I see.
Other solutions possible.
 
H

Helmut Weber

Welcome.
Small improvement here, in case you want to
replace any text in the cell
oRng.End = oRng.End - 1
' oRng.Collapse

Greetings from Bavaria, Germany
Helmut Weber, MVP
"red.sys" & chr(64) & "t-online.de"
Word 2002, Windows 2000
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top