Results 1 to 3 of 3
  1. #1
    2 Star Lounger
    Join Date
    Sep 2001
    Location
    Blue Springs, Missouri, USA
    Posts
    108
    Thanks
    1
    Thanked 0 Times in 0 Posts

    ChDir (XL2K3 SP1)

    I am trying to get Excel to save the file to a certain path / folder / directory but I cannot get Excel to Change Directory. Here is the code..

    Sub Filename01()
    Sheets("Filenaming").Select
    Range("A5").Select
    SIRWorkbook = ActiveCell.Value
    Sheets("Incident Report").Select
    WhereAmI = ActiveWorkbook.Path
    NewPath = "c:downloadtoni"
    ChDir NewPath
    ActiveWorkbook.SaveAs Filename:=NewPath & "" & SIRWorkbook, FileFormat:= _
    xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
    , CreateBackup:=False
    ChDir WhereAmI
    End Sub

    When the code gets to the ChDir command it either gives me an error or just ignores it. Where is my error?

    Thanx

    Dennis

    <img src=/S/gramps.gif border=0 alt=gramps width=20 height=20>

  2. #2
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Weert, Limburg, Netherlands
    Posts
    4,812
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ChDir (XL2K3 SP1)

    You must first activate the drive:

    ChDrive NewPath
    ChDir NewPath
    Jan Karel Pieterse
    Microsoft Excel MVP, WMVP
    www.jkp-ads.com
    Professional Office Developers Association

  3. #3
    2 Star Lounger
    Join Date
    Sep 2001
    Location
    Blue Springs, Missouri, USA
    Posts
    108
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: ChDir (XL2K3 SP1)

    Jan...

    Thanx so much... worked like a dream.

    Dennis

Posting Permissions

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