+ Reply to Thread
Results 1 to 2 of 2

change existing directory in a code to another directory ?

  1. #1
    Valued Forum Contributor
    Join Date
    11-04-2018
    Location
    Denpasar
    MS-Off Ver
    Excel 2010
    Posts
    777

    change existing directory in a code to another directory ?

    I copy a code from Mr. Ron de Bruin website here
    to import/export all macros in each module.

    It works perfectly, thanks to Mr. Ron de Bruin.

    Since I don't understand the codes at all (just using it)
    I would like to know how the code wofrom the code below :

    Please Login or Register  to view this content.
    At the blue line :
    If I directly added a code [msgbox "SpecialPath"] under the blue line, the msgbox shows [D:\Documents].
    Since I want a different directory, I changed the blue line into [SpecialPath = "D:\xxx\"].

    Although the code runs then put the "VBAProjectFiles" folder inside D:\xxx\ directory....
    I wonder, is it OK if I change the blue line into [SpecialPath = "D:\xxx\"] ?

    I ask this because I think the blue line has a connection with the purple line which I don't understand at all what does the purple line code mean...
    so, I am afraid later on maybe the code won't run (trouble) because I change the blue line code into [SpecialPath = "D:\xxx\"] which has no connection with the purple line anymore.

    Any kind of respond would be greatly appreciated.
    Thank you in advanced.

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: change existing directory in a code to another directory ?

    You are completely correct, that you can replace line:
    Please Login or Register  to view this content.
    with line
    Please Login or Register  to view this content.
    When you do this, you no longer use the WshShell object, so you can safely delete the line:
    Please Login or Register  to view this content.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] macro to copy excel files only from main directory and sub directory to a specific folder
    By JEAN1972 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-05-2019, 09:49 AM
  2. [SOLVED] Add question if you need to change the source directory (File) first then run code.
    By bdouglas1011 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-28-2017, 10:44 PM
  3. [SOLVED] Code that looks for directory then remembers the directory location after that.
    By bdouglas1011 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-23-2017, 05:22 AM
  4. [SOLVED] Code to open Files in a Directory and change formula
    By coach.32 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-16-2015, 02:07 AM
  5. VBA code to change backup directory using Orlando’s XLtoEXE
    By newqueen in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-22-2013, 08:27 PM
  6. Add new sheet to existing Excel workbook directory with VB code
    By mzkhrissy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-11-2013, 12:04 AM
  7. Need VBA code to search file in directory and sub-directory and show result
    By johnchencanada in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-19-2012, 11:13 PM

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