Reformatting Data From Access Form to Word Bookmark

S

SusanneV

From an Access form I am using VBA (I'm a beginner)to open
a Word document and insert data into bookmarks. I need a
date field formatted differently in the Word document than
is needed in the Access form. I am using this code:

If objWord.ActiveDocument.Bookmarks.Exists("ClinicDate") =
True Then
Word.ActiveDocument.Bookmarks
("ClinicDate").Range.Text = Me!ClinicDate
End If

The format in Access is mm/dd/yyyy but I need dddd, MMMM
dd, yyyy in Word.

Your help will be greatly appreciated. Thanks!
 
P

Peter Hewett

Hi SusanneV

VBA supports a Format$ function so you can use this:
objWord.ActiveDocument.Bookmarks("ClinicDate").Range.Text = _
Format$(Me!ClinicDate,"dddd, MMMM dd, yyyy")

HTH + Cheers - Peter
 
S

Susanne

Peter,

I just got your message and tried the code. It works
beautifully. Thank you so so much!

Susanne
 
P

Peter Hewett

Hi Susanne

Glad to be able to help - Peter


Peter,

I just got your message and tried the code. It works
beautifully. Thank you so so much!

Susanne

HTH + Cheers - Peter
 

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