Jump to content

Recommended Posts

I've done a search and tried to cobble together my script for opening this excel file. It opens Excel but won't do my Tab, Enter, Tab, Enter to get through "enable mcaros" and "don't update links". Any idea what I'm missing? I'm adding more to the end of this script after but I figured I'd just inclue the questionable part.

HotKeySet("{ESC}","_Excel_Exit")
$MyExcel = ObjCreate("Excel.Application"); Create an Excel Object
if @error then 
  Msgbox (0,"","Error creating Excel object. Error code: " & @error)
  exit
endif
if not IsObj($MyExcel) then 
  Msgbox (0,"ExcelTest","I'm sorry, but creation of an Excel object failed.")
  exit
endif
$oExcel = ObjGet("C:\Sales\CognosFY2006.xls","Excel.Application")
$oExcel.Windows(1).Visible = 1
$MyExcel.Visible = 1
While 1
    Sleep (10)
WEnd
Func _Excel_Exit()
    exit
EndFunc
Send("{TAB}")
Sleep(100)
Send("{ENTER}")
Sleep(100)
Send("{TAB}")
Sleep(100)
Send("{ENTER}")
Sleep(100)
Link to post
Share on other sites

Nevermind, searched further and figured out a much cleaner line...

Run(@comspec & ' /c "S:\Analyst\Weekly Sales\FY2006\CognosFY2006.xls"','',@sw_hide)
Sleep(4000)
Send("{TAB}")
Sleep(1000)
Send("{ENTER}")
Sleep(1000)
Send("{TAB}")
Sleep(1000)
Send("{ENTER}")
Sleep(1000)
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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...