+ Reply to Thread
Results 1 to 6 of 6

Is it possible to alter code from another macro

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    10-02-2013
    Location
    Houston, TX
    MS-Off Ver
    office 365
    Posts
    648

    Is it possible to alter code from another macro

    I have code
     '   Copy additional files for Email
                Dim EDir2 As String
                EDir2 = Sheet7.Range("av2").Value
            
                On Error Resume Next
                'fso.CopyFile EDir2 & "\*_Surveys.xls", TempDir
                'fso.CopyFile EDir2 & "\*_1inMD.pdf", TempDir
                'fso.CopyFile EDir2 & "\*_1inTVD.pdf", TempDir
                fso.CopyFile EDir2 & "\*_5inMD.pdf", TempDir
                fso.CopyFile EDir2 & "\*_5inTVD.pdf", TempDir
                fso.CopyFile EDir2 & "\*_LAS Export.las", TempDir
                'fso.CopyFile EDir2 & "\*_SVY_LAS.las", TempDir
    you can see I have some commented out and some not.

    What I would like to know is can you run a macro that would ask questions about each 6 lines and depending on your answer it would either comment it out or leave it un commented.

    I alter this file manually every time but wondering if I could have a setup macro that would allow other users to do the same without looking at the code itself

  2. #2
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Lightbulb


    Use a Settings sheet for each codeline instead of modifying the code …

  3. #3
    Forum Contributor
    Join Date
    10-02-2013
    Location
    Houston, TX
    MS-Off Ver
    office 365
    Posts
    648

    Re: Is it possible to alter code from another macro

    I am not sure what your are saying can you be more specific.

    Sorry for being VBA ignorant

  4. #4
    Forum Expert
    Join Date
    11-24-2013
    Location
    Paris, France
    MS-Off Ver
    Excel 2003 / 2010
    Posts
    9,831

    Arrow


    As I was not talking about VBA but first just for a Settings sheet where each specific codeline must have a parameter …

  5. #5
    Valued Forum Contributor
    Join Date
    11-26-2012
    Location
    Sydney
    MS-Off Ver
    2010
    Posts
    423

    Re: Is it possible to alter code from another macro

    It is technically possible to do this, but not easy, and I would not recommend it.

    Would something like this work?
    If MsgBox("Copy Surveys.xls?", vbYesNo) = vbYes Then fso.CopyFile EDir2 & "\*_Surveys.xls", TempDir
    If MsgBox("Copy 1inMD.pdf?", vbYesNo) = vbYes Then fso.CopyFile EDir2 & "\*_Surveys.xls", TempDir
    ...

  6. #6
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,481

    Re: Is it possible to alter code from another macro

    Quote Originally Posted by mgs73 View Post
    It is technically possible to do this, but not easy, and I would not recommend it.
    While I don't know for sure, my guess is a user's Anti-Virus software would probably react negatively to the attempt as well.
    Last edited by Rick Rothstein; 11-14-2019 at 12:24 AM.

+ 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] need to alter VBA code to not clear content
    By Delta729 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 07-01-2017, 12:41 AM
  2. [SOLVED] How to alter this code to work
    By vpan in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-26-2016, 11:47 AM
  3. Alter code for only first sheet
    By bosco2 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-26-2015, 03:12 PM
  4. Help me alter this match column code...
    By swade730 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-05-2014, 06:13 PM
  5. [SOLVED] Alter a Deletion Code...Help
    By trevor2524 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 06-12-2014, 02:03 PM
  6. Alter value in one cell alter value in multiple cells
    By Bryan Noqw in forum Excel - New Users/Basics
    Replies: 1
    Last Post: 03-11-2008, 05:31 AM
  7. macro to alter worksheet code
    By cwwolfdog in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-31-2005, 12:06 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