I have researched this and not finding anything. Shouldn't be that difficult to solve. I am trying to open an Excel workbook with VBA in Outlook but it is throwing a mismatch error and I don't know how to fix.
Function openWorkbook()
Dim xlApp As Object
Dim sourceWB As Excel.Application
Set sourceWB = Workbooks.Open("Z:\Stress Test\GSST Daily\weekly report\June\GSST Daily Estimation week of 06.22.xlsx")
End Function
You need to fix your variable declarations. Since you're using early binding, this is pretty straightforward. Also I'd change this to a Sub
if you're not planning to return anything.
Sub OpenWorkbook()
Dim xlApp As Excel.Application
Dim sourceWb As Excel.Workbook
Set xlApp = New Excel.Application
Set sourceWb = xlApp.Workbooks.Open("Z:\Stress Test\GSST Daily\weekly report\June\GSST Daily Estimation week of 06.22.xlsx")
End Sub
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.