sisterwolf
10-18-2010, 06:47 AM
I have a form/spreadsheet that I want to run a macro on that when the user fills in their name in D4 on the Report tab, that tab disappears and the Halloween tab with scary picture and sound are shown and played for 5 seconds and then the Report tab is brought back into view. I've included the report with this posting. I have not yet purchased the .wav file but I do have samples included below the picture.
I am still very new to VBA and have been having a difficult time finding the code for this trick to treat our hard-working field guys on Halloween. Would someone please help me with this code?
Questions:
1- How do I get the code to run automatically? I only know how to get it to work via a button or stepping manually through the code.
2- How do I embed the .wav sound into the workbook? I've found a few practice sounds and have attached the links at the bottom of the hidden Halloween tab.
3- What is the proper code for the 5-second timeframe?
Sub ShowHalloween()
'When Field Tech types his name into cell D4 show Halloween tab and play sound file for 5 seconds
If Sheets("Daily Field Report").Range("D4") <> "" Then
Sheets("Happy Halloween").Visible = True
Sheets("Daily Field Report").Visible = False
'With Application
'.OnTime Now + TimeValue("00:00:05") ... show Halloween tab for 5 seconds
'Play sound file {LongGhostScream (0:04)} ... want to embed sound into workbook
'End With
Sheets("Daily Field Report").Visible = True
Sheets("Happy Halloween").Visible = False
End If
End Sub
I am still very new to VBA and have been having a difficult time finding the code for this trick to treat our hard-working field guys on Halloween. Would someone please help me with this code?
Questions:
1- How do I get the code to run automatically? I only know how to get it to work via a button or stepping manually through the code.
2- How do I embed the .wav sound into the workbook? I've found a few practice sounds and have attached the links at the bottom of the hidden Halloween tab.
3- What is the proper code for the 5-second timeframe?
Sub ShowHalloween()
'When Field Tech types his name into cell D4 show Halloween tab and play sound file for 5 seconds
If Sheets("Daily Field Report").Range("D4") <> "" Then
Sheets("Happy Halloween").Visible = True
Sheets("Daily Field Report").Visible = False
'With Application
'.OnTime Now + TimeValue("00:00:05") ... show Halloween tab for 5 seconds
'Play sound file {LongGhostScream (0:04)} ... want to embed sound into workbook
'End With
Sheets("Daily Field Report").Visible = True
Sheets("Happy Halloween").Visible = False
End If
End Sub