If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Macros automatically updating

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-28-04, 00:18
Jeeper74 Jeeper74 is offline
Registered User
 
Join Date: Apr 2004
Posts: 5
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?
Reply With Quote
  #2 (permalink)  
Old 04-28-04, 00:31
Smitty Smitty is offline
Registered User
 
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
Reply With Quote
  #3 (permalink)  
Old 04-28-04, 00:41
Jeeper74 Jeeper74 is offline
Registered User
 
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
Reply With Quote
  #4 (permalink)  
Old 04-28-04, 00:55
Jeeper74 Jeeper74 is offline
Registered User
 
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.
Reply With Quote
  #5 (permalink)  
Old 04-28-04, 20:25
Smitty Smitty is offline
Registered User
 
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
Reply With Quote
  #6 (permalink)  
Old 04-29-04, 01:17
Jeeper74 Jeeper74 is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On