cancel
Showing results for 
Search instead for 
Did you mean: 

Execute VBA Excel Macro from TestComplete Script

SOLVED
Highlighted
Occasional Contributor

Execute VBA Excel Macro from TestComplete Script

Hello,

 

I have the following need :

 

- I can open an Excel workbook from my TestComplete script. This excel Workbook has two VBA macros : toto() and titi()

 

- Now, I want to execute only the macro toto() that exists in this excel workbook (without titi()). I don't want to execute this macro toto() on the opening of the excel Workbook.

 

So, I need to launch this macro toto() from my TestComplete script, after the opening of the excel workbook. Is it possible ? How ?

 

Thanks for your answer.

 

BR,

Oussama Naffeti.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Manager

Re: Execute VBA Excel Macro from TestComplete Script

Hi Oussama,

We have a sample article demonstrating how to execute a macro:

function Test()
{
  // Gets Excel objects
  var excel = Sys.OleObject("Excel.Application");
 
  // Runs a macro
  excel.Run("toto")
}

 

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

3 REPLIES 3
Highlighted
Community Manager

Re: Execute VBA Excel Macro from TestComplete Script

Hi Oussama,

We have a sample article demonstrating how to execute a macro:

function Test()
{
  // Gets Excel objects
  var excel = Sys.OleObject("Excel.Application");
 
  // Runs a macro
  excel.Run("toto")
}

 

---------
Tanya Gorbunova
SmartBear Community Manager

Did my reply answer your question? Give Kudos or Accept it as a Solution to help others. ⬇️⬇️⬇️

View solution in original post

Highlighted
Occasional Contributor

Re: Execute VBA Excel Macro from TestComplete Script

Thank you Tanya

Highlighted
Contributor

Re: Execute VBA Excel Macro from TestComplete Script

If we want to pass arguments to the macro. How can we do it?
New Here?
Join us and watch the welcome video:
Announcements
Script Wanted
A new challenge is here!

Create a function to drag one element to another for the TechCorner tag!

Will you dare to take the challenge?


Scripts created in July:
- Passing custom command-line arguments as a test parameter
Top Kudoed Authors