View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default Creating Path and FileName

Enclose & with spaces:

Sub MySub()
Dim UserInput1 As String
Dim UserInput2 As String

UserInput1 = InputBox("Enter Data")
UserInput2 = InputBox("Enter Some Moredata")

ActiveWorkbook.SaveAs Filename:="C:\Mypath" & UserInput1 & "\UserInput1" _
& "-" & UserInput2 & ".xlsm", FileFormat:=xlOpenXMLWorkbookMacroEnabled,
CreateBackup:=False
End Sub

--
Gary''s Student - gsnu200856


"Steve" wrote:

Hello,
I am tryin to create a filename and path using Input boxes....

Sub MySub()
Dim UserInput1 as string
Dim UserInput2 as string

UserInput1=inputbox("Enter Data")
UserInput2=inputbox("Enter Some Moredata"

activeWorkBook.SaveAs Filename:="C:\Mypath"&UserInput1&"\UserInput1 _
&"-"UserInput2&".xlsm",FileFormat:=xlOpenXMLWorkbookM acroEnabled,
CreateBackup:=False

But Im getting "expected End of Statement" on the "\"

What am I doing wrong?

Thanks