+ Reply to Thread
Results 1 to 5 of 5

Using variables in a name

  1. #1
    Vispy
    Guest

    Using variables in a name

    Hello,

    Does anyone know how to used a variable in a name?

    My example would by:

    ' fname is short for the name to be given to the newly saved file.
    Dim fname$
    ' dt is short for the date.
    Dim dt$
    ' mth is short for the month.
    Dim mth$

    mth = 1
    yr = 2006

    fname = "Labor-Work-mth-yr"

    I would like to have fname appear as Labor-Work-01-2006.


    Thanks!!



  2. #2
    Bob Phillips
    Guest

    Re: Using variables in a name

    fname = "Labor-Work-" & Format(mth,"00") "-" % Format(yr,"0000")

    --

    HTH

    Bob Phillips

    (remove nothere from the email address if mailing direct)

    "Vispy" <[email protected]> wrote in message
    news:[email protected]...
    > Hello,
    >
    > Does anyone know how to used a variable in a name?
    >
    > My example would by:
    >
    > ' fname is short for the name to be given to the newly saved file.
    > Dim fname$
    > ' dt is short for the date.
    > Dim dt$
    > ' mth is short for the month.
    > Dim mth$
    >
    > mth = 1
    > yr = 2006
    >
    > fname = "Labor-Work-mth-yr"
    >
    > I would like to have fname appear as Labor-Work-01-2006.
    >
    >
    > Thanks!!
    >
    >




  3. #3
    Kevin Vaughn
    Guest

    RE: Using variables in a name

    fname = "Labor-Work-" & mth & "-" & yr

    > mth = 1
    > yr = 2006
    >
    > fname = "Labor-Work-mth-yr"
    >
    > I would like to have fname appear as Labor-Work-01-2006.

    --
    Kevin Vaughn


    "Vispy" wrote:

    > Hello,
    >
    > Does anyone know how to used a variable in a name?
    >
    > My example would by:
    >
    > ' fname is short for the name to be given to the newly saved file.
    > Dim fname$
    > ' dt is short for the date.
    > Dim dt$
    > ' mth is short for the month.
    > Dim mth$
    >


    >
    >
    > Thanks!!
    >
    >
    >


  4. #4
    Vispy
    Guest

    Re: Using variables in a name

    Thanks to Bob & Kevin!!

    "Vispy" <[email protected]> wrote in message
    news:[email protected]...
    > Hello,
    >
    > Does anyone know how to used a variable in a name?
    >
    > My example would by:
    >
    > ' fname is short for the name to be given to the newly saved file.
    > Dim fname$
    > ' dt is short for the date.
    > Dim dt$
    > ' mth is short for the month.
    > Dim mth$
    >
    > mth = 1
    > yr = 2006
    >
    > fname = "Labor-Work-mth-yr"
    >
    > I would like to have fname appear as Labor-Work-01-2006.
    >
    >
    > Thanks!!
    >




  5. #5
    Kevin Vaughn
    Guest

    Re: Using variables in a name

    You're welcome. Although I did miss the 0 before the month part.
    --
    Kevin Vaughn


    "Vispy" wrote:

    > Thanks to Bob & Kevin!!
    >
    > "Vispy" <[email protected]> wrote in message
    > news:[email protected]...
    > > Hello,
    > >
    > > Does anyone know how to used a variable in a name?
    > >
    > > My example would by:
    > >
    > > ' fname is short for the name to be given to the newly saved file.
    > > Dim fname$
    > > ' dt is short for the date.
    > > Dim dt$
    > > ' mth is short for the month.
    > > Dim mth$
    > >
    > > mth = 1
    > > yr = 2006
    > >
    > > fname = "Labor-Work-mth-yr"
    > >
    > > I would like to have fname appear as Labor-Work-01-2006.
    > >
    > >
    > > Thanks!!
    > >

    >
    >
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1