View Single Post
  #9   Report Post  
Posted to microsoft.public.excel.misc
Jacob Skaria Jacob Skaria is offline
external usenet poster
 
Posts: 8,520
Default Current Date Code in form

So you havent tried that right...In VBA Date returns current date..

TODAY() is a worksheet function and not a vBA


If this post helps click Yes
---------------
Jacob Skaria


"Tony" wrote:

How do I use TODAY() to get today's date to appear int he textbox?

"Jacob Skaria" wrote:

'I hope processdate text box is on the form. If so
LienRegistrationForm.Show
LienRegistrationForm.ProcessDate.Text = Format(Date, "mm/dd")


OR use the form initialize event and assign the text box with date as below


Private Sub UserForm_Initialize()
ProcessDate.Text = Format(Date, "mm/dd")
End Sub

--
If this post helps click Yes
---------------
Jacob Skaria


"GTReferee" wrote:

The date is not showing in the form. Also, after the form shows I get a
Runtime 424 error. Here is the code I am using with your suggestion:

Private Sub LienRegistration_Click()
Application.ScreenUpdating = False
Dim nResult As Long
resp = MsgBox(Prompt:="Do you want to clear values?", Buttons:=vbYesNo)
If resp = vbYes Then
Application.Goto Reference:="NFNRRegistrationBusinessName"
Selection.ClearContents
LienRegistrationForm.Show
ProcessDate.Text = Format(Date, "mm/dd")
Sheets("Menu").Select
End If
End Sub

--
GTReferee


"Jacob Skaria" wrote:

ProcessDate.Text = Format(Date,"mm/dd")

If this post helps click Yes
---------------
Jacob Skaria


"Tony" wrote:

I want to have the current date to appear in a form formatted as mm/dd. The
textbox name is ProcessDate.