J
jake
I using automation to word to create report I need. Everything works
great except I get the following for a date:
01/04/2005 --> I need to get "January 04, 2005.
I'm using the following code:
Private Sub Command836_Click()
On Error GoTo MergeButton_Err
Dim objWord As Word.Application
Dim verse As String
'Start Microsoft Word 97.
Set objWord = CreateObject("Word.Application")
verse = [mcverse]
With objWord
'Make the application visible.
..Visible = True
'Open the document.
..Documents.Open (verse)
'Move to each bookmark and insert text from the form.
..ActiveDocument.Bookmarks("First").Select
..Selection.Text = (CStr(Forms!Frontpage2!DFirst))
..ActiveDocument.Bookmarks("Last").Select
..Selection.Text = (CStr(Forms!Frontpage2!DLast))
..ActiveDocument.Bookmarks("Middle").Select
..Selection.Text = (CStr(Forms!Frontpage2!DMiddle))
..ActiveDocument.Bookmarks("Birthdate").Select
..Selection.Text = (CStr(Forms!Frontpage2!Birthdate))
..ActiveDocument.Bookmarks("Birthplace").Select
..Selection.Text = (CStr(Forms!Frontpage2!BirthCity))
..ActiveDocument.Bookmarks("Birthstate").Select
..Selection.Text = (CStr(Forms!Frontpage2!BirthState))
..ActiveDocument.Bookmarks("Deathdate").Select
..Selection.Text = (CStr(Forms!Frontpage2!DeathDate))
..ActiveDocument.Bookmarks("Deathcity").Select
..Selection.Text = (CStr(Forms!Frontpage2!DCty))
..ActiveDocument.Bookmarks("Deathstate").Select
..Selection.Text = (CStr(Forms!Frontpage2!DState))
..ActiveDocument.Bookmarks("Time").Select
..Selection.Text = (CStr(Forms!Frontpage2!ServTime))
..ActiveDocument.Bookmarks("Day").Select
..Selection.Text = (CStr(Forms!Frontpage2!ServDay))
..ActiveDocument.Bookmarks("Date").Select
..Selection.Text = (CStr(Forms!Frontpage2!ServDate))
..ActiveDocument.Bookmarks("Place").Select
..Selection.Text = (CStr(Forms!Frontpage2!ServPlace))
..ActiveDocument.Bookmarks("City").Select
..Selection.Text = (CStr(Forms!Frontpage2!ServCity))
..ActiveDocument.Bookmarks("State").Select
..Selection.Text = (CStr(Forms!Frontpage2!ServState))
..ActiveDocument.Bookmarks("Minister").Select
..Selection.Text = (CStr(Forms!Frontpage2!Minister))
..ActiveDocument.Bookmarks("Cemetery").Select
..Selection.Text = (CStr(Forms!Frontpage2!Cemetery))
..ActiveDocument.Bookmarks("Cemcity").Select
..Selection.Text = (CStr(Forms!Frontpage2!CemCity))
..ActiveDocument.Bookmarks("Cemstate").Select
..Selection.Text = (CStr(Forms!Frontpage2!CemState))
End With
MergeButton_Err:
'If a field on the form is empty, remove the bookmark text, and
'continue.
If Err.Number = 94 Then
objWord.Selection.Text = ""
Resume Next
Else
End If
Exit Sub
End Sub
+++++++++++++++++++++++++++++
Please help.
Thank you.
Jake
great except I get the following for a date:
01/04/2005 --> I need to get "January 04, 2005.
I'm using the following code:
Private Sub Command836_Click()
On Error GoTo MergeButton_Err
Dim objWord As Word.Application
Dim verse As String
'Start Microsoft Word 97.
Set objWord = CreateObject("Word.Application")
verse = [mcverse]
With objWord
'Make the application visible.
..Visible = True
'Open the document.
..Documents.Open (verse)
'Move to each bookmark and insert text from the form.
..ActiveDocument.Bookmarks("First").Select
..Selection.Text = (CStr(Forms!Frontpage2!DFirst))
..ActiveDocument.Bookmarks("Last").Select
..Selection.Text = (CStr(Forms!Frontpage2!DLast))
..ActiveDocument.Bookmarks("Middle").Select
..Selection.Text = (CStr(Forms!Frontpage2!DMiddle))
..ActiveDocument.Bookmarks("Birthdate").Select
..Selection.Text = (CStr(Forms!Frontpage2!Birthdate))
..ActiveDocument.Bookmarks("Birthplace").Select
..Selection.Text = (CStr(Forms!Frontpage2!BirthCity))
..ActiveDocument.Bookmarks("Birthstate").Select
..Selection.Text = (CStr(Forms!Frontpage2!BirthState))
..ActiveDocument.Bookmarks("Deathdate").Select
..Selection.Text = (CStr(Forms!Frontpage2!DeathDate))
..ActiveDocument.Bookmarks("Deathcity").Select
..Selection.Text = (CStr(Forms!Frontpage2!DCty))
..ActiveDocument.Bookmarks("Deathstate").Select
..Selection.Text = (CStr(Forms!Frontpage2!DState))
..ActiveDocument.Bookmarks("Time").Select
..Selection.Text = (CStr(Forms!Frontpage2!ServTime))
..ActiveDocument.Bookmarks("Day").Select
..Selection.Text = (CStr(Forms!Frontpage2!ServDay))
..ActiveDocument.Bookmarks("Date").Select
..Selection.Text = (CStr(Forms!Frontpage2!ServDate))
..ActiveDocument.Bookmarks("Place").Select
..Selection.Text = (CStr(Forms!Frontpage2!ServPlace))
..ActiveDocument.Bookmarks("City").Select
..Selection.Text = (CStr(Forms!Frontpage2!ServCity))
..ActiveDocument.Bookmarks("State").Select
..Selection.Text = (CStr(Forms!Frontpage2!ServState))
..ActiveDocument.Bookmarks("Minister").Select
..Selection.Text = (CStr(Forms!Frontpage2!Minister))
..ActiveDocument.Bookmarks("Cemetery").Select
..Selection.Text = (CStr(Forms!Frontpage2!Cemetery))
..ActiveDocument.Bookmarks("Cemcity").Select
..Selection.Text = (CStr(Forms!Frontpage2!CemCity))
..ActiveDocument.Bookmarks("Cemstate").Select
..Selection.Text = (CStr(Forms!Frontpage2!CemState))
End With
MergeButton_Err:
'If a field on the form is empty, remove the bookmark text, and
'continue.
If Err.Number = 94 Then
objWord.Selection.Text = ""
Resume Next
Else
End If
Exit Sub
End Sub
+++++++++++++++++++++++++++++
Please help.
Thank you.
Jake