G
Guest
Hi. I'm trying to run an excel macro through a VB app and am getting 2 weird errors (one which I managed to fix but am not sure why it was broken in the first place). Here's the little snippet of code causing the problems:
Dim XLapp As Excel.Application
Set XLapp = New Excel.Application
Dim WB As Excel.Workbook
Set WB = XLapp.Workbooks.Open(filepath_here)
XLapp.Run "macro_name", file_i_want_macro_to_act_on
The first weird bug is, the XLapp.Workbooks.Open fails if I give
an absolute filepath. I fixed it by giving a relative path, but I'm not
sure why that is necessary.
The second problem I still cannot resolve is I get an error saying that
a macro with that name could not be found (but there is a macro with
that name). Am I calling the Run method improperly??
Thanks.
Dim XLapp As Excel.Application
Set XLapp = New Excel.Application
Dim WB As Excel.Workbook
Set WB = XLapp.Workbooks.Open(filepath_here)
XLapp.Run "macro_name", file_i_want_macro_to_act_on
The first weird bug is, the XLapp.Workbooks.Open fails if I give
an absolute filepath. I fixed it by giving a relative path, but I'm not
sure why that is necessary.
The second problem I still cannot resolve is I get an error saying that
a macro with that name could not be found (but there is a macro with
that name). Am I calling the Run method improperly??
Thanks.