+ Reply to Thread
Results 1 to 4 of 4

Macro Saves to Incorrect Directory

  1. #1
    Registered User
    Join Date
    10-18-2010
    Location
    Vancouver, BC
    MS-Off Ver
    Excel 2007
    Posts
    47

    Question Macro Saves to Incorrect Directory

    I've got the following code in my simple user form used to save three types of documents to the appropriate folder:

    Please Login or Register  to view this content.
    For some reason I cannot figure out, when "Service Quote" is selected, the macro saves it into the "Service Reports" folder. I have triple-checked the filepath. I don't understand? Can anyone see something I am missing here? I won't pretend to be good at this, yet. Thank you very much if you can tell me where I've gone wrong.

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,482

    Re: Macro Saves to Incorrect Directory

    I don't think changing the directory automatically means the workbook will save in that directory.
    A path is required.
    For example using the macro recorder.
    Please Login or Register  to view this content.
    This will produce the same effect
    Please Login or Register  to view this content.
    Changing the directory is not required

  3. #3
    Forum Expert Greg M's Avatar
    Join Date
    08-16-2007
    Location
    Dublin. Ireland
    MS-Off Ver
    Office 2016
    Posts
    4,481

    Re: Macro Saves to Incorrect Directory

    Hi there,

    I'm not a great believer in using the ChDir command, and prefer to use a fully-qualified filename when saving a file.

    Try the following code and see if it does what you require:

    Please Login or Register  to view this content.

    Hope this helps - please let me know how you get on.

    Regards,

    Greg M

  4. #4
    Registered User
    Join Date
    10-18-2010
    Location
    Vancouver, BC
    MS-Off Ver
    Excel 2007
    Posts
    47

    Re: Macro Saves to Incorrect Directory

    Thank you for your help! I rewrote the code, eliminating the ChDir command based on the codes provided and it is working properly now as far as I can tell. Thank you again!

+ 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