Keeping format while transfering data

puffer317

Registered User.
Local time
Yesterday, 19:46
Joined
Apr 15, 2008
Messages
18
Hello, I have a spreadsheet which calculates a few simple numbers. I then use the code below to send those numbers to a preformatted word document. If I send $6.00 from the spreadsheet, it shows in word as 6. If I send .00235 from the spreadsheet, it shwos as .0024 in word. How do I keep the formatting during this transfer.

Thanks in advance.

Dim wdApp As Word.Application
Dim myDoc As Word.Document
Dim mywdRange As Word.Range
Dim STemplatePath As String
Dim strMaterialCost As Excel.Range

Set strMaterialCost = Sheets("Sheet1").Range("G18")
Set wdApp = New Word.Application

With wdApp
.Visible = True
.WindowState = wdWindowStateMaximize
End With

STemplatePath = "C:\QuoteLog\Quote Cost Card.doc"
Set myDoc = wdApp.Documents.Add(STemplatePath)

With myDoc.Bookmarks
.Item("quoteItemNumber").Range.InsertAfter txtItemNumber
.Item("quoteNumber").Range.InsertAfter txtQuoteNumber
.Item("quoteItemDescription").Range.InsertAfter txtOperationDescription
.Item("quoteDate").Range.InsertAfter cboDate
.Item("quoteCustomer").Range.InsertAfter txtCustomer
.Item("quoteMaterialCost").Range.InsertAfter strMaterialCost
.Item("quoteTotalCost").Range.InsertAfter strMaterialCost
End With
 
You could try using Type Conversion Functions when you send the data to your bookmarks. Example:
Code:
.Item("quoteMaterialCost").Range.InsertAfter [b]CCur([/b]strMaterialCost[b])[/b]
I don't know if it will work, but it might be worth a shot.
 
No luck. Thx though.
 

Users who are viewing this thread

Back
Top Bottom