Hi,
I want to store today value in a string in VBA Word, e.g. today is Oct 04 2012, the string will be = "04102012". Any simple code can achieve that?

Thanks!

Recommended Answers

You would use something like -

Sub FormatNow()
    Dim myWorksheetName As String
    myWorksheetName = Format(Now, "mmmm_yyyy")
    MsgBox myWorksheetName
End Sub
Jump to Post

All 3 Replies

You would use something like -

Sub FormatNow()
    Dim myWorksheetName As String
    myWorksheetName = Format(Now, "mmmm_yyyy")
    MsgBox myWorksheetName
End Sub

Thanks, the code works perfectly well!

    Dim dateStr As String    
    dateStr = Format(Now, "ddmmyyyy")

Only a pleasure. Please mark as solved thanx.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.