|
baomaboy 发表于 2011-9-16 21:36
不好意思,在我这运行出错,所以无法测试,开始以为是我的excel安装时没装文本到语音造成的,后来看出错代 ...
如果你那行有错,就不要减1,把"- 1"不,因为你把活动单元格放在了A1单元格
改为:
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
Set d = CreateObject("Scripting.Dictionary")
intR = ActiveCell.Row
intC = ActiveCell.Column
If intR > 0 Then
strT = Cells(intR, intC)
length = Len(strT)
If length > 0 Then
For i = 1 To length
ch = Mid(strT, i, 1)
Application.Speech.Speak Mid(strT, i, 1)
Next i
End If
End If
End Sub
|
|