VBA中的一些代码
让OFFICE能识别文档中的文字
如果要让此程序能运行,要添加EXCEL的引用,只有EXCEL才有此功能
Sub SpeakIt()
Set x = New Excel.Application
x.Speech.Speak (ActiveWindow.Selection)
Set x = Nothing
End Sub
让PPT能随机出题。
Slides 一个代表指定演示文稿中所有幻灯片的 Slides 集合。只读。
Sub RandomlyPlay()
Dim num As Integer
Randomize
Dim i As Integer
n = ActivePresentation.Slides.Count - 1
i = Int(n * Rnd + 1)
' MsgBox i
ActiveWindow.View.GotoSlide i
End Sub
'
Sub InsertTitle()
Range("A1").Select
ActiveCell.EntireRow.Select
Selection.Copy
ActiveCell.Offset(2, 0).Range("A1").EntireRow.Select
Do While Not ActiveCell.Text = ""
Selection.Insert Shift:=xlDown
ActiveCell.EntireRow.Select
Selection.Copy
ActiveCell.Offset(2, 0).Range("A1").EntireRow.Select
Loop
Application.CutCopyMode = False '2?′|óú???D?ò?′???£ê?
End Sub