|

楼主 |
发表于 2024-5-24 15:43
|
显示全部楼层
- #If VBA7 Then
- Private Declare PtrSafe Function sndPlaySound32 Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
- #Else
- Private Declare Function sndPlaySound32 Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
- #End If
- Private Sub Alert(ByVal success As Boolean)
- Dim FlName
- If success Then FlName = "\success.wav" Else FlName = "\Fcyc_wat.wav"
- FlName = ThisWorkbook.Path & FlName
- sndPlaySound32 FlName, 0& '无窗口播放wav声音
- End Sub
- Private Sub Worksheet_Change(ByVal Target As Range)
- '扫码限定一次一个,填写到B列
- If Target.Column <> 2 Then Exit Sub
- If Target.Row = 1 Then Exit Sub
- With Target
- If .Value = "shanchushuju" Then
- Range("B1").Select
- Range("B:B").Clear
- End If
- End With
- 原厂吊牌码 = [b1].Value
- Alert Target.Value = 原厂吊牌码
- End Sub
复制代码
这段代码就是用的,这是之前论坛老师写的,现在想用在我的表格里。不知道老师能移到我的表格里。谢谢。 |
|