Convert date to string and insert into Word doc

riggsd

Board Regular
Joined
Jan 29, 2003
Messages
143
I've tried different VBA string and date value functions to do this but so far, none of them have worked.

I need to pull a date in mm/dd/yyyy format from a form in Access and put it into a Word document.

For the document title and revision, this is the code:

wrdDoc.Bookmarks("title").Range.InsertBefore (CStr(frmName.Document_Title))
wrdDoc.Bookmarks("revision2").Range.InsertBefore (CStr(frmName.Document_Revision))

Initially, I had assumed that using CStr would convert the date to a short date string:

wrdDoc.Bookmakrs("docdate").Range.InsertBefore (CStr(frmName.Document_Date))

but nothing shows up in my Word document at the docdate bookmark. I tried using "Format" to format the date but still nothing. Obviously, I'm doing something wrong.

Ultimately, I would like to convert the date to the following format prior to inserting into the Word file: dd mm yyyy, i.e., 23 February 2017, etc.

Thanks in advance,
Dar
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
I need to pull a date in mm/dd/yyyy format from a form in Access and put it into a Word document.
If your field is truly a date field, this would work:
Code:
Format(DateField,"mm/dd/yyyy")

If that does not work out, I suspect something on the other side of things (Word) may be interfering.
 
Upvote 0

Forum statistics

Threads
1,221,714
Messages
6,161,467
Members
451,708
Latest member
PedroMoss2268

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top