Results 1 to 6 of 6
  1. #1
    Join Date
    Apr 2004
    Posts
    5

    Unanswered: Macros automatically updating

    Hello,
    I am having a problem with macros. I have written a traffic control program (kinda). It simply uses macros to copy and paste pre-drawn graphics of highways. My problem is when I open the program (traffic.xls) and draw some section of road, and then save under a new file name, the next time I open traffic, the macros point to the graphics in the new file. I don't know what I may have done to make this happen, but it is annoying! Can anyone help me?

  2. #2
    Join Date
    Dec 2003
    Location
    San Diego, CA
    Posts
    153
    Welcome to the Board!

    Can you post your code?

    It's likely that you're referring to another workbook in it.

    Smitty

  3. #3
    Join Date
    Apr 2004
    Posts
    5
    Here is one of the codes in my sheet. This code remains the same when I save it, what is updating is the assigned macro on the buttons.

    '
    Sheets("Roads").Select
    ActiveSheet.Shapes("Group 40").Select
    Selection.Copy
    Sheets("Traffic Control Plan").Select
    Range("D16").Select
    ActiveSheet.Paste
    End Sub

  4. #4
    Join Date
    Apr 2004
    Posts
    5
    I just looked at the button to see if I could figure out what macro it is saying is assigned to it. The origonal assigned macro was,

    Traffic.xls!twolaneh

    and after I saved it as 318.xls

    'D:\Documents and Settings\Master\Desktop\318.xls'!twolaneh

    It does this automatically.

  5. #5
    Join Date
    Dec 2003
    Location
    San Diego, CA
    Posts
    153
    OK,

    Delete your current button, then View-->Toolbars-->Control Toolbox and draw a new button. In Edit Mode (the triangle with a pencil), double click and paste your code between the Command Button1_Click() and End Sub.

    Now there are no file references to change

    Hope that helps,

    Smitty

  6. #6
    Join Date
    Apr 2004
    Posts
    5
    Thanks for your help, but I am changing how I am doing this program. I am going to use hyperlinks to insert pictures from my custom tool bar and this is working for me. It is a bit slower (I have to redo all of my roads and signs) but all of the hyperlinks work in both the origonal file and the drawn saved one.

    Thanks again
    Jeeper74

Posting Permissions

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