[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 323
  • Last Modified:

VBA Date

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

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.
0
aneilg
Asked:
aneilg
  • 3
  • 2
1 Solution
 
macarrillo1Commented:
Your use of 'date' in

format(date,"yyyymmdd")

Is this a variable you created or a fieldname or the function date?
0
 
Peter KipropCommented:
Hi aneilg,

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

Open in new window

0
 
macarrillo1Commented:
You could also do:

        Dim strName As String
        Dim strDate as string

        strName = "test"
        strDate=format(date,"yyyymmdd")
        strName = strName & strDate
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
macarrillo1Commented:
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")
0
 
aneilgAuthor Commented:
thanks, perfect.
0
 
aneilgAuthor Commented:
thanks, perfect.
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now