N
Neil Holden
Please see below, this is a button for when pressed a save as dialog appears
with the name of whatever appears in C7 and the current date, but when i
press ok to save nothing happens!! Please help i'm so close to finishing.
Dim Response As String
Dim msg As String
Dim Style As String
Dim sFilename As String
Dim ans
Dim flToSave As Variant
Dim flName As String
Dim flFormat As Long
msg = "Are you sure you want to save the Smith quote?"
Style = vbYesNo + vbInformation + vbDefaultButton2
Response = MsgBox(msg, Style)
If Response = vbYes Then
flFormat = ActiveWorkbook.FileFormat
DefaultFolder = "M:\Design"
If Right(DefaultFolder, 1) <> "\" Then
DefaultFolder = DefaultFolder & "\"
End If
DefaultFilename = Range("C7")
If Right(UCase(DefaultFilename), 2) <> "XLS" Then
DefaultFilename = DefaultFilename & Format(Date, "ddmmyyyy") & ".xls"
'DefaultFilename = DefaultFilename & ".xls"
End If
'Create a FileDialog object as a File Picker dialog box.
Set fd = Nothing
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
..InitialFileName = DefaultFolder & DefaultFilename
..Filters.Add "Excel Files", "*.xls", 1
..Title = "Save File As..."
..Show
If .SelectedItems.Count = 0 Then
Exit Sub
End If
with the name of whatever appears in C7 and the current date, but when i
press ok to save nothing happens!! Please help i'm so close to finishing.
Dim Response As String
Dim msg As String
Dim Style As String
Dim sFilename As String
Dim ans
Dim flToSave As Variant
Dim flName As String
Dim flFormat As Long
msg = "Are you sure you want to save the Smith quote?"
Style = vbYesNo + vbInformation + vbDefaultButton2
Response = MsgBox(msg, Style)
If Response = vbYes Then
flFormat = ActiveWorkbook.FileFormat
DefaultFolder = "M:\Design"
If Right(DefaultFolder, 1) <> "\" Then
DefaultFolder = DefaultFolder & "\"
End If
DefaultFilename = Range("C7")
If Right(UCase(DefaultFilename), 2) <> "XLS" Then
DefaultFilename = DefaultFilename & Format(Date, "ddmmyyyy") & ".xls"
'DefaultFilename = DefaultFilename & ".xls"
End If
'Create a FileDialog object as a File Picker dialog box.
Set fd = Nothing
Set fd = Application.FileDialog(msoFileDialogFilePicker)
With fd
..InitialFileName = DefaultFolder & DefaultFilename
..Filters.Add "Excel Files", "*.xls", 1
..Title = "Save File As..."
..Show
If .SelectedItems.Count = 0 Then
Exit Sub
End If