2
我有以下簡單的Excel電子表格:小數點分隔符在電子郵件(HTML/CSS)在Excel的VBA編程
A B C
1 25,000,000.50
2
3
而下面的VBA代碼與內容發送電子郵件單元格A1:
Sub Separators_in_Email()
If ExitAll = False Then
Dim OApp As Object, OMail As Object, signature As String
Set OApp = CreateObject("Outlook.Application")
Set OMail = OApp.CreateItem(0)
With OMail
.display
End With
signature = OMail.HTMLBody
With OMail
.To = "[email protected]"
.Subject = "test"
.HTMLBody = "<p> I want this number " & Sheet1.Range("A1") & " to be shown with its decimal separators as in the Excel sheet</p>"
End With
Set OMail = Nothing
Set OApp = Nothing
Else
End If
End Sub
電子郵件本身完美的作品。
但是,正如您在Excel電子表格中所看到的,我使用「,」作爲小數分隔符。在電子郵件中,不使用這個小數點分隔符。相反,該號碼被寫爲25000000.5而沒有「,」。
有沒有在VBA或HTML/CSS中顯示帶有正確小數點分隔符的數字的方法?