colinharwood
Active Member
- Joined
- Jul 27, 2002
- Messages
- 440
- Office Version
- 365
- Platform
- Windows
Hi I am trying to take the value from an inputbox to use as the directory path in a filesaveas routine, but cannot figure out the correct format using the following code
Sub Path_Exists()
Dim Path As String
Dim Folder As String
Dim Answer As VbMsgBoxResult
Dim Response As String
'Update the path to a valid path on your PC
Path = "D:\Tonbridge MES"
Folder = Dir(Path, vbDirectory)
If Folder = vbNullString Then
Answer = MsgBox("Path D:\Tonbridge MES does not exist. Would you like to create it?", vbYesNo, "Create Path?")
Select Case Answer
Case vbYes
VBA.FileSystem.MkDir (Path)
Case Else
Response = InputBox("Please enter the location where you would like the file saved to.")
ActiveWorkbook.SaveAs FileName:="Response" \ "Email list", FileFormat:=xlCSV
End Select
End If
End Sub
It works up until the Case else statement. ANy help much appreciated
Thanks
Colin
Sub Path_Exists()
Dim Path As String
Dim Folder As String
Dim Answer As VbMsgBoxResult
Dim Response As String
'Update the path to a valid path on your PC
Path = "D:\Tonbridge MES"
Folder = Dir(Path, vbDirectory)
If Folder = vbNullString Then
Answer = MsgBox("Path D:\Tonbridge MES does not exist. Would you like to create it?", vbYesNo, "Create Path?")
Select Case Answer
Case vbYes
VBA.FileSystem.MkDir (Path)
Case Else
Response = InputBox("Please enter the location where you would like the file saved to.")
ActiveWorkbook.SaveAs FileName:="Response" \ "Email list", FileFormat:=xlCSV
End Select
End If
End Sub
It works up until the Case else statement. ANy help much appreciated
Thanks
Colin