在excel报表中使用语音提示

上传人:wm****3 文档编号:42938415 上传时间:2018-06-04 格式:DOC 页数:2 大小:25KB
返回 下载 相关 举报
在excel报表中使用语音提示_第1页
第1页 / 共2页
在excel报表中使用语音提示_第2页
第2页 / 共2页
亲,该文档总共2页,全部预览完了,如果喜欢就下载吧!
资源描述

《在excel报表中使用语音提示》由会员分享,可在线阅读,更多相关《在excel报表中使用语音提示(2页珍藏版)》请在金锄头文库上搜索。

1、Option ExplicitDeclare Function sndPlaySound Lib “winmm.dll“ Alias “sndPlaySoundA“ (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long再在 Workbook 的 BeforeSave 事件中(根据需要也可以选用其他事件)加入下列用 VBA 编 写的宏代码:With Sheet1If .Range(“A2“).Value2 Or .Range(“A2“).Value-2 Then判断 A2 单元格内的数据是否大于 2 或小于负 2x% = sn

2、dPlaySound(“C:语音语音 01.wav“, uFlags%)播放语音文件“C:语音语音 01.wav”End IfIf .Range(“B2“).Value2 Or .Range(“B2“).Value-2 Then判断 B2 单元格内的数据是否大于 2 或小于负 2x% = sndPlaySound(“C:语音语音 02.wav“, uFlags%)播放语音文件“C:语音语音 02.wav”End IfEnd WithPrivate Sub Worksheet_Change(ByVal Target As Range) 如果输入后按回车, 可以实现逐个字符朗读 Dim lengt

3、h As Integer Dim i As Integer Dim strT As String Dim ch As String Dim intR As Integer, intC As Integer MsgBox “你修改了数据 “ intR = ActiveCell.Row intC = ActiveCell.Column If intR 0 Then strT = Cells(intR - 1, intC) length = Len(strT) If length 0 Then For i = 1 To length ch = Mid(strT, i, 1) Application.

4、Speech.Speak ch Next i End If End If End Sub Private Sub Worksheet_SelectionChange(ByVal Target As Range) 如果单元 格在选定状态下按方向键,或者用鼠标改变活动单元格触发 Dim length As Integer Dim i As Integer Dim strT As String Dim ch As String Dim intR As Integer, intC As Integer intR = ActiveCell.Row intC = ActiveCell.Column If

5、intR 0 Then strT = Cells(intR - 1, intC) length = Len(strT) If length 0 Then For i = 1 To length ch = Mid(strT, i, 1) Application.Speech.Speak ch Next i End If End If End Sub Sub 输入() Dim length As Integer Dim i As Integer Dim strT As String Dim ch As String strT = ActiveCell.Text length = Len(strT) If length 0 Then For i = 1 To length ch = Mid(strT, i, 1) Application.Speech.Speak ch Next i End If End Sub

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 生活休闲 > 社会民生

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号