+ Reply to Thread
Results 1 to 3 of 3

Changing the macros automatically

  1. #1
    Forum Contributor
    Join Date
    12-02-2013
    Location
    england
    MS-Off Ver
    Excel 2007
    Posts
    112

    Lightbulb Changing the macros automatically

    HI,

    There is a code in an excel file which is in the following folder="C:\CALCULATIONS\FIRST".

    Please Login or Register  to view this content.
    When i copy-paste the "FIRST" folder the new path of that pasted folder is as followes="C:\CALCULATIONS\FIRST - Copy"
    but Here, the only barrier is that the file path in the code always remains constant .

    For eg:

    Please Login or Register  to view this content.
    After pasting was expected to be changed to

    Please Login or Register  to view this content.
    But the name of that "FIRST" folder stays as it is, instead of changing to "FIRST - Copy"

    Please anyone enlighten me in this matter.

    Thank you
    Last edited by LAVA2; 10-14-2015 at 10:08 AM.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Changing the macros automatically

    Hi, LAVA2,

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)

    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 2019 on Win10 (desktop), 2019 on Win11 (notebook)
    Posts
    8,197

    Re: Changing the macros automatically

    Hi, LAVA2,

    assuming that the main workbook with the code will always be located in the directory where the other folders are located like indicated you may try this code which will use ThisWorkbook.Path which will show the path and folder of the main workbook (without the finishing backslash) and work from there on:

    Please Login or Register  to view this content.
    Youi might consider to rename your thread as from what I understand you would like to alter the relative path to the foldersd with the workbooks.

    But there must be some other action taken as I´m having a hard time understanding why you would loop to open a workbook and close it directly thereafter.

    Ciao,
    Holger

+ 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. Macros for changing variables with password
    By mshaheenlk in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 05-09-2013, 02:47 AM
  2. Replies: 6
    Last Post: 02-29-2012, 02:13 AM
  3. Macros name changing.
    By Mordred in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-10-2010, 11:24 AM
  4. Automatically Changing Copy Range in Macros
    By jfoote in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 03-25-2009, 02:05 PM
  5. Changing the default “macros in all workbooks”
    By aca in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-01-2006, 10:35 AM
  6. [SOLVED] Macros for sumif and changing range
    By csimont in forum Excel General
    Replies: 2
    Last Post: 01-27-2006, 04:35 PM
  7. changing file names with macros
    By trevor@OML in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-09-2005, 12:25 PM
  8. Changing shortcut keys on macros
    By WayneB in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-13-2005, 04:06 PM

Tags for this Thread

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