Sign in to follow this  
Followers 0
martmeister

Excel Macro Question

3 posts in this topic

Here is my code:

#include <Excel.au3>

run ("C:\Program Files\Microsoft Office\Office12\EXCEL.exe") ;opens excel

winwaitactive ("Microsoft Excel - Book1")

sleep (900)

Global $oExcel = _ExcelBookOpen("C:\Documents and Settings\programHopper.xlsm")

WinWait("Microsoft Excel - programHopper.xlsm")

Sleep(2000)

$oExcel.Run("MacroHop")

The Last Line Is Where Im Getting My Error..ehh, I dont know why its not running the macro called MacroHop

The Macro is Part of the the program Hopper and works correctly when I manually run it so i know it works. I just need some help automating this. lol

thanks!

Share this post


Link to post
Share on other sites



Try this :

$filename = "C:\Documents and Settings\programHopper.xlsm"
$oExcel = ObjCreate("Excel.Application") ;crete excel object
$oExcel.WorkBooks.Open($FileName) ;open desired file containing the macro
$oExcel.Run("MacroHop") ;run the macro

it 100% works i always use it =)

Share this post


Link to post
Share on other sites

Try this one:

$oExcel.WorkBooks.Open($FileName)
$oExcel.Run("Macro1")

It works for me. Maybe you need to check the Macro permissions and security settings.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0