我尝试使用下面的宏将excel名称“3”中的值复制到当前excel名称“1”但是当我执行时我得到编译错误方法或找不到数据成员我在Vb脚本中不好任何人请帮帮我
Sub Update()
Dim sPath As String
Dim objExcel As Application
Dim sValue As String
Dim wbTarget As Workbooks
Dim strName As String
Set wbThis = ActiveWorkbook
strName = ActiveSheet.Name
sPath = "C:\Users\nikhil.surendran\Desktop\1"
Set wbTarget = Workbooks.Open("C:\Users\nikhil.surendran\Desktop\3" & strName & ".xlsx")
sValue = wbTarget.Sheets(1).Range("A1").Value
Set objExcel = CreateObject("Excel.Application")
With objExcel
.Visible = False
.DisplayAlerts = 0
.ActiveWorkbook.Sheets(1).Range("B11").Value = sValue
.ActiveWorkbook.Save
.Quit
End With
End Sub
Thanks in Advance.