Bookmark Currency Formatting within VBA

SpeedyFingers

New Member
Joined
Mar 26, 2012
Messages
38
In need of some desperate help. Can't get the bookmark to keep the excel (Currency) format. Any help is appreciated.

Code:
    Set oDoc = oApp.Documents.Add    oApp.Selection.InsertFile strTemplate
    'locate each bookmark
    For Each oBookMark In oDoc.Bookmarks
        Set objX = wsData.Rows(1).Find(oBookMark.Name, LookIn:=xlValues, lookat:=xlWhole)


        If Not objX Is Nothing Then
            ' found
            If Right(oBookMark.Name, 3) = "ClosingCost" Then
                oBookMark.Range.Text = Format("ClosingCost", "$#,##0.00_);($#,##0.00)")
'            ElseIf Right(oBookMark.Name, 2) = "Loan" Then
'                oBookMark.Range.Text = Format(wsData.Cells(rng2.Row, objX.Column), "Loan")
'            Else
                oBookMark.Range.Text = wsData.Cells(rng2.Row, objX.Column)
'            End If
        Else
            MsgBox "Bookmark '" & oBookMark.Name & "' not found", vbOKOnly + vbCritical, "error"
            GoTo Tidy_Exit
        End If
    Next oBookMark
    '


    oDoc.SaveAs strWordDocumentName & ".doc"
    oDoc.Close
Next rng2
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.

Forum statistics

Threads
1,216,136
Messages
6,129,084
Members
449,485
Latest member
greggy

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