Am trying to automate the testing of an XL based tool. The key steps are to click on 3 buttons which trigger 3 macros. Though 2 of them can be successfully done, the last one is not working as this macro calls an XLL (excel DLL) which in turn calls a method in it. In a nutshell, is it possible to automate XLLs in QTP?
Extern.Declare does not help as I wouldn’t know the argument values to be explicitly passed to the required method in the XLL.
Sorry for delayed reply. I had given up hope as i didnt see any response for 2 days. Thank you very much for your reply.
Here's my code:
Set a = CreateObject("Excel.Application")
a.DisplayAlerts = False
a.Application.Visible = True
Set b = a.Workbooks.Open("C:\Uploader.xls")
a.Application.Run "'Uploader.xls'!clearTemplate" --> This works as it is a macro
a.Application.Run "'Uploader.xls'!GenerateTable" --> This also works as it is a macro
a.RegisterXLL "customDLL.xll" --> This one and next step were added to explicitly load the DLL
a.Application.AddIns.Add("C:\Documents and Settings\mivi\Application Data\Microsoft\AddIns\customDLL.xll")
a.Application.Run "'C:\Uploader.xls'!generateXML" --> This does not work as this macro calls XLL
..but how would you run the macro if you weren't automating? Is there a menu item or button you press? You could try replicating this.
Alternatively, you have not mentioned what happens when you try to run the macro? It may be the case that the function is private and can not be called from outside of excel. If that is the case, try wrapping it in a public VBA function as demonstrated here :