Jump to content

Excel Macro Question


Recommended Posts

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!

Link to comment
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 =)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...