PDA

View Full Version : [SOLVED:] Run-Time Error '1004"



LEETENY
10-25-2018, 06:32 AM
I am fairly new at creating Macros and I have created a workbook for my department to share and use. When my colleagues run the macro with out changing the file name it works great. But when they save the workbook in a new name and come back to run my macro they run in to the Error:
"Run-time error '1004' Sorry, we couldn't find C:\Users\LTENY\Document\thefilename.xslsm. Is it possible it was moved, renamed or deleted? "

When I debug the macro is looking for the original file name to run the macro.

Is the solution to write the macro so that when the name is change it can be run with any name? If so I would love to get some help on to make this happen. I would appreciate any help.


This is my current macro. I call it the master macro, but cause it make other macros run.



Sub All()
'
' All Macro
'


'
Application.Run "'Subsidy Check Application Pilot.xlsm'!Start"
Application.Run "'Subsidy Check Application Pilot.xlsm'!ARFLWUP"
Application.Run "'Subsidy Check Application Pilot.xlsm'!Earn"
Application.Run "'Subsidy Check Application Pilot.xlsm'!NoAction"
Application.Run "'Subsidy Check Application Pilot.xlsm'!AGDisc"
Application.Run "'Subsidy Check Application Pilot.xlsm'!Action"
Application.Run "'Subsidy Check Application Pilot.xlsm'!BuildFW"
End Sub

Paul_Hossler
10-25-2018, 07:09 AM
Welcome to the forum

I added CODE tags to your macro. You can use the [#] icon to insert the pair and paste your macro between to set it off and format it nicely

2. If the seven macros are in the workbook, you should be able to just run by name, without the .Run and the workbook name




Option Explicit
Sub All()
Start
ARFLWUP
Earn
NoAction
AGDisc
Action
BuildFW
End Sub




If that's not it, come back with some more details.

Also my sig has some reading materials and tips for new members, especially the part about cross posting to other forums without telling us

LEETENY
10-25-2018, 07:18 AM
Paul,

THAT WORKED!!! Oh my goodness! I have tried to research this so many times that I can't believe someone was able to help. This is my first ever forum to join or post, but I was getting so worried that I was not going to have finished project for a department of 200 people that needs to be rolled out in 2 weeks. Thank you SOOOOOO much! :clap:

Like I said I'm fairly new and pretty much self taught with Macros, so I'm sure I will be back with more questions.

Paul_Hossler
10-25-2018, 08:06 AM
Don't you hate it when computers do what you TELL them to do, and not what you WANT them to do :yes

Come back anytime with more questions

Don't forget to mark your thread [SOLVED] -- #3 in my sig