martmeister Posted July 24, 2009 Posted July 24, 2009 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!
nuberoid Posted July 24, 2009 Posted July 24, 2009 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 =)
Juvigy Posted July 24, 2009 Posted July 24, 2009 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.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now