jcutler
03-10-2014, 03:05 PM
First problem.
Private Sub cmdbtnFilesave_Click()
If MsgBox("Would you like to save this file now?", Title:="Save File", Buttons:=vbCritical + vbYesNo) = vbYes Then
FileToSave = Application.GetSaveAsFilename("Tie Testing" & Format(Sheet1.Range("A1"), "mmmddyyyy" & "TO" & Format(Sheet5.Range("v1"), "mmmddyyyyy")), Filefilter:="Microsoft Office Excel Workbook(*.xlsx),*.xlsx", Title:="Save File")
If FileToSave <> False Then
ActiveWorkbook.SaveAs FileToSave, FileFormat:=xlNormal
End If
End If
End Sub
The above code is embedded into an activex command button. When I click on the command button in the cell, it displays the message box when I click yes, displays a "Run-time error '424': Object required."
The line "FileToSave = Application.GetSaveAsFilename("Testing" & Format(Sheet1.Range("A1"), "mmmddyyyy" & "TO" & Format(Sheet5.Range("v1"), "mmmddyyyyy")), Filefilter:="Microsoft Office Excel Workbook(*.xlsx),*.xlsx", Title:="Save File")" is highlighted in yellow. Did I code this wrong? Thanks.
Private Sub cmdbtnFilesave_Click()
If MsgBox("Would you like to save this file now?", Title:="Save File", Buttons:=vbCritical + vbYesNo) = vbYes Then
FileToSave = Application.GetSaveAsFilename("Tie Testing" & Format(Sheet1.Range("A1"), "mmmddyyyy" & "TO" & Format(Sheet5.Range("v1"), "mmmddyyyyy")), Filefilter:="Microsoft Office Excel Workbook(*.xlsx),*.xlsx", Title:="Save File")
If FileToSave <> False Then
ActiveWorkbook.SaveAs FileToSave, FileFormat:=xlNormal
End If
End If
End Sub
The above code is embedded into an activex command button. When I click on the command button in the cell, it displays the message box when I click yes, displays a "Run-time error '424': Object required."
The line "FileToSave = Application.GetSaveAsFilename("Testing" & Format(Sheet1.Range("A1"), "mmmddyyyy" & "TO" & Format(Sheet5.Range("v1"), "mmmddyyyyy")), Filefilter:="Microsoft Office Excel Workbook(*.xlsx),*.xlsx", Title:="Save File")" is highlighted in yellow. Did I code this wrong? Thanks.