Jump to content

Error:Error opening File


Recommended Posts

#include-once
#include <MsgBoxConstants.au3>
#Include <File.au3>

$oExcel = ObjCreate("Excel.Application")
$oExcel.Visible =  0

HotKeySet("{DEL}", "ExitScript")
Func ExitScript()
    $oExcel.Application.Quit
    MsgBox($MB_ICONERROR, "MESSAGE", 'PROCESS ABORTED')
    Exit
EndFunc

WinActivate("Application")
Global $hWnd = WinWaitActive("Application", "", 5)

$oExcel.Application.WorkBooks.Open("C:\Users\Charlie\Desktop\Data.xlsx")

I do not have AutoIt installed on my machine. I am using the 'AutoIt– Self Extracting Archive' to execute my script. I am getting the below error when I execute the script. What am I missing

Line 2 (File "C\Users\Charlie\Desktop\Script.au3"):

#include <MsgBoxConstants.au3>

Error:Error opening File

Link to comment
Share on other sites

If you are running AutoIt from a zipped folder, then that's your problem. You need to extract all of the AutoIt files to a folder and run it from there. When you run something from a zipped folder, it only extracts the item you are running and all other files are still in the zipped folder. Therefore, the #include you referenced is not in the temp folder that your zip program created.

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...