我一直在:
运行时错误'1004'无法获取WorksheetFunction类的Vlookup属性
使用下面的Vlookup代码。
如果我启用Microsoft outlook 12.0 Object Library
它可以工作,但是我遇到的问题是代码与Excel 2013一起使用并添加了excel 2007上没有的Microsoft outlook 15.0 Object Library
引用。我已经合并了后期绑定大部分除了这一段代码。
我已经提供了一段代码,我希望这些代码足以帮助我。
Sub Button154_Click()
Dim forename As String
Dim surname As String
Dim movedate As String
Dim callref As String
Dim dept As String
Dim deptmove As String
Dim wb As Workbook
Set wb = ThisWorkbook
forename = Sheet1.Range("f8").Value
surname = Sheet1.Range("f9").Value
movedate = Sheet1.Range("k13").Value
callref = Sheet1.Range("k8").Value
dept = Application.WorksheetFunction.VLookup(Name, Sheet1.Range("K10"), 1)
答案 0 :(得分:0)
添加了后期绑定代码 Dim otlApp As Object 设置otlApp = CreateObject(" Outlook.Application")
将vlookup更改为: dept = Application.WorksheetFunction.VLookup(oltApp,Sheet1.Range(" K10"),1)
现在效果很好