我对VBA很新,但我正在尝试制作一个程序,在选择和右键单击MS Word中的单词时提供翻译建议。我在Found.Address的代码中收到消息“Compile-Error:Method or data member not found”:
Dim Current As String
Dim oSheet As Range
Dim Found As Range
Dim firstAddress As String
Dim oChanges As Worksheet
Dim sFname As String
Dim oExcel As Excel.Application
Set oExcel = New Excel.Application
oExcel.Visible = False
sFname = "C:\Users\user\Desktop\translations.xlsx"
Set oChanges = oExcel.Workbooks.Open(FileName:=sFname)
Set oSheet = ActiveSheet.UsedRange
'Prepping Excel File
Set oSheet = ActiveSheet.UsedRange
Current = Selection.Text
With oSheet
Set Found = .Find(Current)
If Not Found Is Nothing Then
firstAddress = Found.Address
Do
.................................
我直接从VBA的Range.Find帮助页面复制了这种格式。我错过了什么?