userform vlookup在文本框中

时间:2018-05-15 05:22:57

标签: outlook vlookup userform

我对VBA真的很陌生,试图玩弄基本的东西,userform和vlookup。几小时后无法找出vlookup错误。感谢任何意见!

Private Sub cmdClose_Click()
    Unload Me
End Sub

Private Sub cmdSend_Click()

' emailcommand Macro

'
Dim oApp As Outlook.Application
Dim oMail As MailItem
Set oApp = New Outlook.Application
Set oMail = oApp.CreateItem(olMailItem)

With oMail
    .To = emailaddress.Value
    .Subject = Subjectbox.Value
    .Body = "Hi, " & Fundname.Value & " is ready"
    .Display
    Application.SendKeys "%s"
End With

End Sub


Private Sub Fundnumber_Change()
Dim ws As Worksheet
Set ws = Sheets("Matrix")

With Me
    .Fundname.Text = Application.VLookup(.Fundnumber.Text, ws.Range("A2:D141"), 4, False)
End With

End Sub

0 个答案:

没有答案