MsgBox for filename and static path

  • Thread starter Thread starter BillB
  • Start date Start date
B

BillB

I have a file at the end of a macro that needs to be saved as an
employees name and a date to a directory I want to define.

I want to use a MsgBox and ask for Name and Date. How do I then
convert the entry in the msgbox and join it to my path so the file is
saved with the right name and in the right place?
 
Dim nm as string
dim dt as string
nm = InputBox("Please Enter your name")
dt = InputBox("Please Enter a date" & vbCrLf & "Use format mm-dd-yyyy")
If not isdate(format(var1,"mm-dd-yyyy")) Then
Msgbox "Invalid Date, exiting macro"
Exit Sub
End if
ActiveWorkbook.SaveAs Filename:=YourStaticPath & nm & dt & ".xls"
 
Try something like this...


Dim MyValue As String
Dim filepath
Dim filename

MyValue = InputBox("Enter your name", "Name Entry Dialog")
fileame = MyValue & "_" & Date

Filepath = "c:\whereever\" & filename

ThisWorkBook.SaveAs Filename:=Filepath

ThisWorkBooK.Close
 
Back
Top