-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShelfCheck_v3_Module.bas
More file actions
87 lines (65 loc) · 2.44 KB
/
ShelfCheck_v3_Module.bas
File metadata and controls
87 lines (65 loc) · 2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
Attribute VB_Name = "Module1"
'Following conditional statements will execute based on the version of Excel that is being used.
#If VBA7 Then
Private Declare PtrSafe Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, ByVal dwFlags As Long) As Long
#Else
Private Declare PtrSafe Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, ByVal dwFlags As Long) As Long
#End If
Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_FILENAME = &H20000
'Creates a sound effect by binding a '.wav' file found in the given directory.
Sub PlayWAV()
Dim WAVFile As String
WAVFile = "C:\Users\GKQNG\Desktop\siren.wav"
Call PlaySound(WAVFile, 0&, SND_ASYNC Or SND_FILENAME)
End Sub
'Sound effect #2.
Sub PlayWAV2()
Dim WAVFile2 As String
WAVFile2 = "C:\Windows\Media\chord.wav"
Call PlaySound(WAVFile2, 0&, SND_ASYNC Or SND_FILENAME)
End Sub
'Sound effect #3.
Sub PlayWAV3()
Dim WAVFile2 As String
WAVFile2 = "C:\Windows\Media\tada.wav"
Call PlaySound(WAVFile2, 0&, SND_ASYNC Or SND_FILENAME)
End Sub
Sub Shelf_Check()
'Loops through each Sheet. If no Sheet named "Shelf_Check" is found, creates one.
For i = 1 To Worksheets.Count
If Worksheets(i).Name = "Shelf_Check" Then
exists = True
End If
Next i
If Not exists Then
Sheets.Add
ActiveSheet.Name = "Shelf_Check"
End If
'Creates variables with the location for each header.
Dim cart_header As Range: Set cart_header = Range("A1")
Dim shelf_header As Range: Set shelf_header = Range("B1")
Dim inv_bid_header As Range: Set inv_bid_header = Range("C1")
Dim scans_header As Range: Set scans_header = Range("D1")
'Adds text to headers.
cart_header.Value = "Cart #"
shelf_header.Value = "Shelf #"
inv_bid_header.Value = "Inv_BID"
scans_header.Value = "Scans"
'Makes the headers yellow.
cart_header.Interior.ColorIndex = 6
shelf_header.Interior.ColorIndex = 6
inv_bid_header.Interior.ColorIndex = 6
scans_header.Interior.ColorIndex = 6
'Formats columns 1, 2, and 4 for bold text.
Worksheets("Shelf_Check").Range("A:A").Font.Bold = True
Worksheets("Shelf_Check").Range("B:B").Font.Bold = True
Worksheets("Shelf_Check").Range("D:D").Font.Bold = True
'Opens the sheck_check userform.
shelf_check_userform.Show
End Sub