Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-10-2015, 09:36 AM
tesoke tesoke is offline Can we define macros in a way to not misworking after deleting, renaming or moving the source file? Windows 8 Can we define macros in a way to not misworking after deleting, renaming or moving the source file? Office 2010 64bit
Advanced Beginner
Can we define macros in a way to not misworking after deleting, renaming or moving the source file?
 
Join Date: Apr 2015
Posts: 56
tesoke is on a distinguished road
Default Can we define macros in a way to not misworking after deleting, renaming or moving the source file?

Hi, I made a macro with name "Yellow" in a excel file named file1. Then, I add this Yellow macro to Quick Access Toolbar and automatically it worked for other excel files. After some days, I changed the name of file1 to filex. After that the Yellow macro does not work anyway. It shows an error and says: "Sorry we could not find file1. It is possible it moved or deleted or renamed?"

1) Why macros do not work after deleting, renaming or moving the source file, which we define them in it?



2) Is there any way to solve this problem? Can we define macros in a way to not misworking after deleting, renaming or moving the source file?

Thanks for any help.
Reply With Quote
  #2  
Old 11-11-2015, 02:26 AM
macropod's Avatar
macropod macropod is online now Can we define macros in a way to not misworking after deleting, renaming or moving the source file? Windows 7 64bit Can we define macros in a way to not misworking after deleting, renaming or moving the source file? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Quote:
Originally Posted by tesoke View Post
1) Why macros do not work after deleting, renaming or moving the source file, which we define them in it?
Because if you define the file as one thing, then change it to something else, how is the macro supposed to know? The only file a macro can work out file names & paths for after they've been changed is the file containing it. Even then, if you change a worksheet name, position in the file, add or delete a worksheet, that could break a macro. It is up to you to maintain the code so that it works in such cases.
Quote:
Originally Posted by tesoke View Post
2) Is there any way to solve this problem? Can we define macros in a way to not misworking after deleting, renaming or moving the source file?
Sure, but you have to code the macro to do what you want it to under such circumstances.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 11-11-2015, 02:51 AM
Debaser's Avatar
Debaser Debaser is offline Can we define macros in a way to not misworking after deleting, renaming or moving the source file? Windows 7 64bit Can we define macros in a way to not misworking after deleting, renaming or moving the source file? Office 2010 32bit
Competent Performer
 
Join Date: Oct 2015
Location: UK
Posts: 221
Debaser will become famous soon enough
Default

Quote:
Originally Posted by tesoke View Post
1) Why macros do not work after deleting, renaming or moving the source file, which we define them in it?
Because the QAT contains a full path to the file containing the code and that is not updated when you rename the file.

Quote:
2) Is there any way to solve this problem? Can we define macros in a way to not misworking after deleting, renaming or moving the source file?
Yes - don't use the QAT. Customise the Ribbon using the CustomUI part of the workbook. That way all the customisation is stored in the workbook itself, not in a separate file as it is with the QAT.
Reply With Quote
  #4  
Old 11-11-2015, 03:13 PM
tesoke tesoke is offline Can we define macros in a way to not misworking after deleting, renaming or moving the source file? Windows 8 Can we define macros in a way to not misworking after deleting, renaming or moving the source file? Office 2010 64bit
Advanced Beginner
Can we define macros in a way to not misworking after deleting, renaming or moving the source file?
 
Join Date: Apr 2015
Posts: 56
tesoke is on a distinguished road
Default

Thank you so much macropod and Debaser!

Quote:
Originally Posted by Debaser View Post
Yes - don't use the QAT. Customise the Ribbon using the CustomUI part of the workbook. That way all the customisation is stored in the workbook itself, not in a separate file as it is with the QAT.
Would you please explain this way more. I am a newcomer and do not know much. I can work with macro only with clicking on Record Macro and Stop Macro! I do not know what is QAT and about programming in excel. I do not want to waste your time so much. If you say some notes I will navigate about them and find the solution.

Thanks again.
Reply With Quote
  #5  
Old 11-11-2015, 03:44 PM
macropod's Avatar
macropod macropod is online now Can we define macros in a way to not misworking after deleting, renaming or moving the source file? Windows 7 64bit Can we define macros in a way to not misworking after deleting, renaming or moving the source file? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

I don't think the QAT (Quick Access Toolbar) is particularly relevant here - it only comes into play if you attach a macro to it.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #6  
Old 11-12-2015, 02:38 PM
tesoke tesoke is offline Can we define macros in a way to not misworking after deleting, renaming or moving the source file? Windows 8 Can we define macros in a way to not misworking after deleting, renaming or moving the source file? Office 2010 64bit
Advanced Beginner
Can we define macros in a way to not misworking after deleting, renaming or moving the source file?
 
Join Date: Apr 2015
Posts: 56
tesoke is on a distinguished road
Default

Thank you macropod! I got what is QAT

Quote:
Originally Posted by Debaser View Post
Yes - don't use the QAT. Customise the Ribbon using the CustomUI part of the workbook. That way all the customisation is stored in the workbook itself, not in a separate file as it is with the QAT.
Would you please explain what is Ribben, CustomUI and workbook? I think if you explain these, you will solve my problem. Thanks a lot.
Reply With Quote
  #7  
Old 11-12-2015, 02:45 PM
macropod's Avatar
macropod macropod is online now Can we define macros in a way to not misworking after deleting, renaming or moving the source file? Windows 7 64bit Can we define macros in a way to not misworking after deleting, renaming or moving the source file? Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You really shouldn't need anyone to explain what the Ribbon is or what a workbook is. They're standard terms and you cannot use Excel without them. I suggest you do a web search on these terms...
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #8  
Old 11-12-2015, 03:43 PM
tesoke tesoke is offline Can we define macros in a way to not misworking after deleting, renaming or moving the source file? Windows 8 Can we define macros in a way to not misworking after deleting, renaming or moving the source file? Office 2010 64bit
Advanced Beginner
Can we define macros in a way to not misworking after deleting, renaming or moving the source file?
 
Join Date: Apr 2015
Posts: 56
tesoke is on a distinguished road
Default

Thank you so much. Bless U.
Reply With Quote
  #9  
Old 11-13-2015, 02:24 AM
tesoke tesoke is offline Can we define macros in a way to not misworking after deleting, renaming or moving the source file? Windows 8 Can we define macros in a way to not misworking after deleting, renaming or moving the source file? Office 2010 64bit
Advanced Beginner
Can we define macros in a way to not misworking after deleting, renaming or moving the source file?
 
Join Date: Apr 2015
Posts: 56
tesoke is on a distinguished road
Default

Quote:
Originally Posted by tesoke View Post
2) Is there any way to solve this problem? Can we define macros in a way to not misworking after deleting, renaming or moving the source file?
Quote:
Originally Posted by macropod View Post
Sure, but you have to code the macro to do what you want it to under such circumstances.
Would you please more? How can code macro to ...?
Reply With Quote
  #10  
Old 11-13-2015, 02:45 AM
Debaser's Avatar
Debaser Debaser is offline Can we define macros in a way to not misworking after deleting, renaming or moving the source file? Windows 7 64bit Can we define macros in a way to not misworking after deleting, renaming or moving the source file? Office 2010 32bit
Competent Performer
 
Join Date: Oct 2015
Location: UK
Posts: 221
Debaser will become famous soon enough
Default

I suggest you read this site: http://www.rondebruin.nl/win/section2.htm
Reply With Quote
  #11  
Old 11-13-2015, 09:30 AM
tesoke tesoke is offline Can we define macros in a way to not misworking after deleting, renaming or moving the source file? Windows 8 Can we define macros in a way to not misworking after deleting, renaming or moving the source file? Office 2010 64bit
Advanced Beginner
Can we define macros in a way to not misworking after deleting, renaming or moving the source file?
 
Join Date: Apr 2015
Posts: 56
tesoke is on a distinguished road
Default

Quote:
Originally Posted by Debaser View Post
I suggest you read this site: http://www.rondebruin.nl/win/section2.htm
Thank you, I read your proposed link and I got it. Thank you all and sorry to waste your time and bother you. Thanks again
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Can we define macros in a way to not misworking after deleting, renaming or moving the source file? Macros to move objects prevents moving same objects with arrow keys BruceM Word VBA 1 03-10-2015 08:20 AM
Deleting and moving word documents tenpasteight Word 3 06-01-2014 11:10 AM
define a mail merge data source using unc (universal naming convention) charlesandrews Mail Merge 0 08-21-2012 10:33 AM
Deleting sections without formatting moving up pamorrison Word 1 04-20-2012 02:14 AM
truncating path or renaming audio file to play in powerpoint rbookend PowerPoint 0 05-02-2006 03:39 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:44 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft