popetropolis
New Member
- Joined
- Aug 15, 2013
- Messages
- 18
I would like for "Object 3" which is an mp3 file to play on my "Start Page" when the "image1" is clicked. I can double click Object 3 and it plays, but I can not seem to get my code to play it. Code I added for the mp3 to play is in red. Thanks!!!!
Private Sub Image1_Click()
Dim save_as As Variant
Dim file_name As String
Dim ProgramName As String
file_name = ProgramName
' Get the file name.
save_as = Application.GetSaveAsFilename(file_name, _
FileFilter:="Excel Files,*.xlsm,All Files,*.*")
' See if the user canceled.
If save_as = False Then Exit Sub
' Save the file with the new name.
Application.DisplayAlerts = False
If LCase$(Right$(save_as, 4)) <> ".xlsm" Then
file_name = save_as & ".xlsm"
End If
ActiveWorkbook.SaveAs Filename:=save_as
Worksheets("Gen Info").Visible = True
Worksheets("S Input").Visible = True
Worksheets("E Input").Visible = True
Worksheets("LOOSE").Visible = True
Worksheets("Job Summary").Visible = True
Worksheets("Gen Info").Select
ErrorHandler:
Sheets("Start Page").Select
ActiveSheet.Unprotect
Application.DisplayAlerts = False 'to turn off the warning'
Range("A1").Select
ActiveSheet.Shapes("Object 3").Select
Selection.Verb Verb:=xlPrimary
Application.DisplayAlerts = True 'turn the warning back on
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Worksheets("Start Page").Visible = False
End Sub
Private Sub Image1_Click()
Dim save_as As Variant
Dim file_name As String
Dim ProgramName As String
file_name = ProgramName
' Get the file name.
save_as = Application.GetSaveAsFilename(file_name, _
FileFilter:="Excel Files,*.xlsm,All Files,*.*")
' See if the user canceled.
If save_as = False Then Exit Sub
' Save the file with the new name.
Application.DisplayAlerts = False
If LCase$(Right$(save_as, 4)) <> ".xlsm" Then
file_name = save_as & ".xlsm"
End If
ActiveWorkbook.SaveAs Filename:=save_as
Worksheets("Gen Info").Visible = True
Worksheets("S Input").Visible = True
Worksheets("E Input").Visible = True
Worksheets("LOOSE").Visible = True
Worksheets("Job Summary").Visible = True
Worksheets("Gen Info").Select
ErrorHandler:
Sheets("Start Page").Select
ActiveSheet.Unprotect
Application.DisplayAlerts = False 'to turn off the warning'
Range("A1").Select
ActiveSheet.Shapes("Object 3").Select
Selection.Verb Verb:=xlPrimary
Application.DisplayAlerts = True 'turn the warning back on
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True
Worksheets("Start Page").Visible = False
End Sub