Friday, July 24, 2009

How to create a VBA Function Library for Use in VBScript/QTP

Creating a VBA Function Library for Use in VBScript/QTP:
1. Open your MS Excel Sheet.

2. Open a Module to write a VBA function. To open open Visual Basic Editor mudule folow this: Click ‘Tools => Macro => Visual Basic Editor
(This could be different for different version of MS Excel)

3. Insert => Module


4. Write your functions in the module



5. Save your excel work book in a folder with suitable name(for example: C:\Joli.xls), you need to provide this path to your qtp script.

6. Write the code in QTP to use your VBA functions

‘Create Excel application Object
‘Use Run method of application to run the function
‘Run (“’Path of excel file’!Modulename.Function Name”,”i/p Arguments”,”i/p arguments”)

No comments:

Post a Comment