Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have the following line of code in my add-in.
obj.textbox1.value = format(Date) I find that the format function often produces inconsistent results, i.e. sometimes it produces null strings. Anyone know why? |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Not sure what you wabt Date to look like but try this
format's date as 061407 Format(Date, "[$-409]mmddyy;@") "TimK" wrote: I have the following line of code in my add-in. obj.textbox1.value = format(Date) I find that the format function often produces inconsistent results, i.e. sometimes it produces null strings. Anyone know why? |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I tried that and it still gives me null strings.
"Mike" wrote: Not sure what you wabt Date to look like but try this format's date as 061407 Format(Date, "[$-409]mmddyy;@") "TimK" wrote: I have the following line of code in my add-in. obj.textbox1.value = format(Date) I find that the format function often produces inconsistent results, i.e. sometimes it produces null strings. Anyone know why? |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Post what you have
"TimK" wrote: I tried that and it still gives me null strings. "Mike" wrote: Not sure what you wabt Date to look like but try this format's date as 061407 Format(Date, "[$-409]mmddyy;@") "TimK" wrote: I have the following line of code in my add-in. obj.textbox1.value = format(Date) I find that the format function often produces inconsistent results, i.e. sometimes it produces null strings. Anyone know why? |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here is an edited excerpt of my code:
Public gate As Boolean Public formtype As Boolean Public r1, c1, col, row As Integer Const sTblPrefix = "=[ODCmgt.xla]DataFields!" Sub newpar() ' ' this is called when the NEW PAR button is clicked ' Dim z As Long Dim rng As Range x1Down = -4121 Dim mydate As Date r1 = ActiveCell.Cells.row 'save where cursor is in spreadsheet c1 = ActiveCell.Cells.Column .. .. .. If Cells(2, 1).Value = Empty Then ' if this is the first par to enter ActiveSheet.Cells(2, 1).Select ' set focus Cells(2, 1).Value = 1 ' set par # GoTo skp ' and get on with it End If Range("A1").End(x1Down).Select ' jump to last format(row,0,0,0) in spreadsheet z = ActiveCell.Cells.row + 1 ' calc next empty line's column ActiveCell.Offset(1, 0).Select 'jump the cursor there skp: col = 1 ' save location of new line's coordinates row = ActiveCell.Cells.row Load NewPARForm ' load the form first 'Init the controlsource properties for the new spreadsheet line With NewPARForm .TextBox1.ControlSource = address(col, row) If ActiveCell.Value < 1 Then z = Cells(row - 1, col).Value + 1 .TextBox1.Value = z 'init w/ next sequential par# End If ActiveCell.Offset(0, 1).Select 'Move cursor to the product field .ComboBox1.SetFocus ' need to move cursor to cell .ComboBox1.ControlSource = address(col + 1, row) .TextBox3.ControlSource = address(col + 2, row) .ComboBox2.ControlSource = address(col + 3, row) .TextBox5.ControlSource = address(col + 4, row) .TextBox5.Value = Format(Date, "[$-409]mmddyy;@") ' initialize the date entered field <<<------------------------------ .ComboBox3.ControlSource = address(col + 5, row) .ComboBox4.ControlSource = address(col + 6, row) The indicated line is where I tried your suggestion. Whey I ran this with a breakpoint at the following line, the .Textbox5.value field showed "" as its content. "Mike" wrote: Post what you have "TimK" wrote: I tried that and it still gives me null strings. "Mike" wrote: Not sure what you wabt Date to look like but try this format's date as 061407 Format(Date, "[$-409]mmddyy;@") "TimK" wrote: I have the following line of code in my add-in. obj.textbox1.value = format(Date) I find that the format function often produces inconsistent results, i.e. sometimes it produces null strings. Anyone know why? |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Not sure try this
.TextBox5.Value = Format(Address(col + 4, row), "[$-409]mmddyy;@") "TimK" wrote: Here is an edited excerpt of my code: Public gate As Boolean Public formtype As Boolean Public r1, c1, col, row As Integer Const sTblPrefix = "=[ODCmgt.xla]DataFields!" Sub newpar() ' ' this is called when the NEW PAR button is clicked ' Dim z As Long Dim rng As Range x1Down = -4121 Dim mydate As Date r1 = ActiveCell.Cells.row 'save where cursor is in spreadsheet c1 = ActiveCell.Cells.Column . . . If Cells(2, 1).Value = Empty Then ' if this is the first par to enter ActiveSheet.Cells(2, 1).Select ' set focus Cells(2, 1).Value = 1 ' set par # GoTo skp ' and get on with it End If Range("A1").End(x1Down).Select ' jump to last format(row,0,0,0) in spreadsheet z = ActiveCell.Cells.row + 1 ' calc next empty line's column ActiveCell.Offset(1, 0).Select 'jump the cursor there skp: col = 1 ' save location of new line's coordinates row = ActiveCell.Cells.row Load NewPARForm ' load the form first 'Init the controlsource properties for the new spreadsheet line With NewPARForm .TextBox1.ControlSource = address(col, row) If ActiveCell.Value < 1 Then z = Cells(row - 1, col).Value + 1 .TextBox1.Value = z 'init w/ next sequential par# End If ActiveCell.Offset(0, 1).Select 'Move cursor to the product field .ComboBox1.SetFocus ' need to move cursor to cell .ComboBox1.ControlSource = address(col + 1, row) .TextBox3.ControlSource = address(col + 2, row) .ComboBox2.ControlSource = address(col + 3, row) .TextBox5.ControlSource = address(col + 4, row) .TextBox5.Value = Format(Date, "[$-409]mmddyy;@") ' initialize the date entered field <<<------------------------------ .ComboBox3.ControlSource = address(col + 5, row) .ComboBox4.ControlSource = address(col + 6, row) The indicated line is where I tried your suggestion. Whey I ran this with a breakpoint at the following line, the .Textbox5.value field showed "" as its content. "Mike" wrote: Post what you have "TimK" wrote: I tried that and it still gives me null strings. "Mike" wrote: Not sure what you wabt Date to look like but try this format's date as 061407 Format(Date, "[$-409]mmddyy;@") "TimK" wrote: I have the following line of code in my add-in. obj.textbox1.value = format(Date) I find that the format function often produces inconsistent results, i.e. sometimes it produces null strings. Anyone know why? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel Format Problem - Date Overrides Format | Excel Discussion (Misc queries) | |||
General Format to Custom format problem | Excel Discussion (Misc queries) | |||
how do you write format results of a function within a function? | Excel Worksheet Functions | |||
Problem with format function in excel VBa | Excel Worksheet Functions | |||
Problem with function format | Excel Worksheet Functions |