我需要在文档中找到特定文本并获取段落编号位置
这是针对 Excel VBA 的
Sub exportardatos()
'Paso 1: Declare las variables
Dim Paragraphe As Object, WordApp As Object, WordDoc As Object, WordTable As Object, WordRange As Object
File = "C:\Users\lper\Documents\FormExp.docx"
On Error Resume Next
'creationsession Word
Set WordApp = GetObject(class:="Word.Application")
'Clear the error between errors
Err.Clear
If WordApp Is Nothing Then Set WordApp = CreateObject(class:="Word.Application")
If Err.Number = 429 Then
MsgBox "Microsoft Word could not be found, aborting."
GoTo EndRoutine
End If
On Error GoTo 0
WordApp.Visible = True …Run Code Online (Sandbox Code Playgroud)