I have what are most likely are very easy questions, however I can’t find anything to adapt to my purpose. I have a user form in Outlook that collects some data from the currently opened email.
Code for that:
[vba]Private Sub btnCollect_Click()
Dim myOlApp As Outlook.Application
Dim myItem As Outlook.MailItem
Set myOlApp = CreateObject("Outlook.Application")
Set myItem = myOlApp.ActiveInspector.CurrentItem
txtRequest.Text = myItem.SenderName
txtTime.Text = myItem.ReceivedTime
Set myOlApp = Nothing
Set myItem = Nothing
End Sub[/vba]
Question 1: How can I get outlook to do a vlookup on a certain excel sheet (I:\Directories\Employee Directory.xls) looking up the value of txtRequest in column A and giving me back column E into text field called txtBranch.
I don’t care if the file actually opens (it's read only), I just need the data.
Question 2: I have another button btnUpdate. I need it to update a spreadsheet called “Scan on Demand Merge.xls”. I have seen how to open a sheet and update it, but on this particular one, the spread sheet will already be open. I don’t want it to try and open it, just to activate the sheet and place each field from my user form into excel. The data for example will be txtRequest will go into the next available row in column D. And another issue with that part is that I wont be starting from row one each time. It just needs to append to the end.
This would be so much easier if I could write this part exactly like I write things in excel, that at least makes sense. I am completely confused with the syntax in using outlook for excel.
Any help would be wonderful.
Thanks so much,
Christina