I have the following code that takes text form a from and inserts it into a word document.
It works well however I would like the text inserted to be in currency format.
In access the format is as follows. $10,000.00. When converted to word as a bookmark it displays as 10000.
The bookmark is in a text from field in word, albeit I have changed the drop down field to currency.
I have searched everywhere for what I would have thought should be quite simple. Any help appreciated.
I would have thought some coding after the following may help.
.ActiveDocument.Bookmarks("payment").Select
.Selection.Text = (CStr(Forms!frm_ladnownerpayments!payment))
Something like this
'ActiveDocument.Bookmarks("payment ").Range.Text = sCurrency'
It works well however I would like the text inserted to be in currency format.
In access the format is as follows. $10,000.00. When converted to word as a bookmark it displays as 10000.
The bookmark is in a text from field in word, albeit I have changed the drop down field to currency.
I have searched everywhere for what I would have thought should be quite simple. Any help appreciated.
I would have thought some coding after the following may help.
.ActiveDocument.Bookmarks("payment").Select
.Selection.Text = (CStr(Forms!frm_ladnownerpayments!payment))
Something like this
'ActiveDocument.Bookmarks("payment ").Range.Text = sCurrency'
Code:
Private Sub Command491_Click()
On Error GoTo Command491_Err
Dim objWord As Word.Application
Set objWord = CreateObject("Word.Application")
With objWord
'Make the application visible.
.Visible = True
'Open the document.
.Documents.Open ("")
'Move to each bookmark and insert text from the form.
.ActiveDocument.Bookmarks("pyament").Select
.Selection.Text = (CStr(Forms!frm_ladnownerpayments!payment))
'objWord.ActiveDocument.PrintOut Background:=False'
'Close the document without saving changes.
'objWord.ActiveDocument.SaveAs ("\\")
objWord.ActiveDocument.SaveAs ")
', FileFormat:=wdFormatPDF'
'objWord.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges'
'Quit Microsoft Word and release the object variable.
'objWord.Quit'
'Set objWord = Nothing'
End With
Exit Sub
Command491_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
'If the Photo field is empty.
ElseIf Err.Number = 2046 Then
MsgBox "Please add a photo to this record and try again."
Else
MsgBox Err.Number & vbCr & Err.Description
End If
Exit Sub
End Sub