Avatar of aneilg
aneilgFlag for United Kingdom of Great Britain and Northern Ireland asked on

VBA Date

i am using vba script to get the date in the following format.

when i use
        Dim strName As String

        strName = "test"
        strName = strName & format(date,"yyyymmdd")

on the date section i get 'of' required when specifying type argument.
VB Script

Avatar of undefined
Last Comment

8/22/2022 - Mon
Michael Carrillo

Your use of 'date' in


Is this a variable you created or a fieldname or the function date?
Peter Kiprop

Hi aneilg,

The below should work
 Dim strName As String
 strName = Format(Date, "yyyymmdd")

Open in new window

Michael Carrillo

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Michael Carrillo

If you are trying to pull the current date you should use the date function: Date()

        Dim strName As String

        strName = "test"
        strName = strName & Format(Date(),"yyyymmdd")
Your help has saved me hundreds of hours of internet surfing.

thanks, perfect.

thanks, perfect.