Results 1 to 4 of 4
  1. #1
    2 Star Lounger
    Join Date
    Jul 2001
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    chdir in vba (2000/97)

    Hello once again

    My question involves changing the directory in vba

    I have mapped a drive to my computer under M: so I want excel to change directory to that and save my file there but it keeps defaulting to the last used folder on my computer, how do I make it change?

    this is what I have so far


    If sheetchosen = Worksheets("Bracket Method(MON)").Name Then
    ChDir "M:Engine FormsOctane" & this_year & "Mon"
    Else
    ChDir "M:Engine FormsOctane" & this_year & "ron"
    End If

    logbookfileformatname = Application.GetSaveAsFilename(logbookfileformatnam e, , , "Save As")

    If logbookfileformatname <> False Then
    ActiveWorkbook.SaveAs Filename:=logbookfileformatname
    End If
    Exit Sub

    the variables "sheetchosen" and "this _year" were given values earlier.
    I don;t understand why the directory is not changing to the one specified. Any recs?

  2. #2
    2 Star Lounger
    Join Date
    Jul 2001
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: chdir in vba (2000/97)

    By the way, the logbookfileformatname was also initialized earlier as well and is not the problem

  3. #3
    Uranium Lounger
    Join Date
    Jan 2001
    Location
    South Carolina, USA
    Posts
    7,295
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: chdir in vba (2000/97)

    You also need a CHDRIVE statement:

    Chdrive "M"
    Legare Coleman

  4. #4
    2 Star Lounger
    Join Date
    Jul 2001
    Posts
    132
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: chdir in vba (2000/97)

    thanks yet again legare

    you are the master of fixing Excel disaster

Posting Permissions

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