MyValue

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to create a macro that will save my file in another location each
month. On of the variables is a folder in the pathname. For some reason, I
can't get it to accept my variable. Here's my example
MyValue = InputBox("Enter Month # ____ YYYY_MM", "Central Analytics")

Windows("MPA Internal.xls").Activate

ActiveWorkbook.SaveAs Filename:= _
"I:\EXLDATA\Loan Recovery MIS\" & MyValue & "\Outstandings\MPA
Internal.xls",
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False

I've tried \MyValue\ " & MyValue & " " MyValue " &MyValue& nothings
working...
Help.
 
Try creating the whole filename as a string variable, and then using that
variable in the SaveAs command, rather than doing the string concatenation in
the SaveAs command.
 
I'm guessing that it isn't your code that's the problem.

Are you sure that this folder exists?
"I:\EXLDATA\Loan Recovery MIS\" & MyValue & "\Outstandings"

===
What does the user type into that inputbox? And what do you expect?

If I type 2, do you need 02?
 
Back
Top