Ao usar o vb 6.0 para fazer uma célula, não podemos forçar a quantidade a ser mostrada com 2 locais após o decimal se o número não tiver o final em 1-9. Por exemplo, 59.12 aparece corretamente, mas se tentarmos 59.10, obteremos 59.1 na célula. Já tentei muitos formatos e saídas de texto diferentes, mas sem sucesso.
Em resposta ao que tentamos abaixo está uma parte do código que temos tentado com mais atenção:
StartForm:
ActiveWorkbook.Styles.Add(Name:="NelcoAmt").NumberFormat = "#.00"
'ActiveWorkbook.Styles("Number").NumberFormat = "######.00"
'ActiveWorkbook.Styles("Number").Application.FixedDecimalPlaces = 2
'ActiveWorkbook.Styles("Currency").Application.Caption = ""
'ActiveWorkbook.Styles("Currency").IncludePatterns = False
'ActiveWorkbook.Styles("Currency").Application. = ""
'ActiveWorkbook.Styles("Currency").Application.
'xlSheet.Cells(1, 34).NumberFormat = "@"
'xlSheet.Cells(2, 34).NumberFormat = "#.00"
'xlSheet.Cells(2, 34).Format = "#.00"
ActiveWorkbook.Styles("NelcoAmt").Application.FixedDecimalPlaces = 2
xlSheet.Cells(2, 34).Style = "NelcoAmt": '.NumberFormat = "#.00": 'Number
'For i% = 1 To ActiveWorkbook.Styles.Count
'Text$ = ActiveWorkbook.Styles(i%).Name
'xlSheet.Cells(i%, 1).Style = Text$
'xlSheet.Cells(i%, 1).Value = 59.4
'xlSheet.Cells(i%, 2).Value = Text$
'Next i%
Rem-----9/15/14---set header for variables
xlSheet.Cells(1, 1).Value = "UniqueFormKey"
xlSheet.Cells(1, 2).Value = "FormName"
xlSheet.Cells(1, 3).Value = "OR_EFIN"
xlSheet.Cells(1, 4).Value = "OR_Type"
Rem======================================start of test section
Dim NumAns As Double
'7/16/15
'NumAns = Format$(Format$(Val(Frm941Inp.Scr941(19)), "########.00"), "@@@@@@@@@@@")
txtOut = Format$(Format$(Val(Frm941Inp.Scr941(19)), "########.00"), "@@@@@@@@@@@")
'NumAns = FormatNumber((Val(Frm941Inp.Scr941(19))), 2)
NumAns = Val(Frm941Inp.Scr941(19))
If Val(Frm941Inp.Scr941(18)) = 0 Then txtOut = "0.00"
txtOut = Frm941Inp.Scr941(19)
'xlSheet.Cells(2, 34).NumberFormat = "@": ' = txtOut: '"########.00"]
'xlSheet.Cells(2, 34) = (FormatNumber(Val(Frm941Inp.Scr941(19)), 2), "text"): 'txtOut ', "########.00"): '5d 2 tax on add medi wage
'xlSheet.Cells(2, 34) = "'" & FormatNumber(Val(Frm941Inp.Scr941(19)), 2): 'txtOut ', "########.00"): '5d 2 tax on add medi wage
'txtOut = "'" & txtOut
xlSheet.Cells(2, 34).Style.NumberFormat = "#.00": 'Number
xlSheet.Cells(2, 34) = Format(NumAns, "#.00"): 'txtOut: 'Val(Frm941Inp.Scr941(19)): 'txtOut ', "########.00"): '5d 2 tax on add medi wage
'xlSheet.Cells(2, 34).Style.NumberFormat = "#.00": 'Number
'xlSheet.Cells(2, 34).NumberFormat = "#.00"
'xlSheet.Cells(2, 34).Value = Val(Frm941Inp.Scr941(19))
'xlSheet.Cells(2, 34).value = FormatNumber(Val(Frm941Inp.Scr941(19)), 2): '"#######.00")
'xlSheet.Cells(2, 34).Value = Format$(Format$(Val(Frm941Inp.Scr941(19)), "########.00"), "@@@@@@@@@@@")
'xlSheet.Cells(2, 34).Value = Val(Frm941Inp.Scr941(19)): '5d 2 tax on add medi wage
Rem===================================end of test section=================================================