• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 329
  • 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
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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