Jump to content
Sign in to follow this  
sammy1983

Variable used without being declared

Recommended Posts

sammy1983

Hi,

I am getting below error

"D:DesktopTest.au3" (62) : ==> Variable used without being declared.:
Local $oExcel = _ExcelBookOpen($sFilePath1, 0, 0)
Local $oExcel = _ExcelBookOpen(^ ERROR
 
Any suggestions?
 
#include <IE.au3>
#include <Date.au3>
#include <String.au3>
#include <Array.au3>
#include <Debug.au3>
#include <Excel.au3>
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <FileConstants.au3>
#include <MsgBoxConstants.au3>
#include <Toast.au3>
#include <WindowsConstants.au3>
#include <EditConstants.au3>

 

Share this post


Link to post
Share on other sites
Melba23

sammy1983,

 

Any suggestions?

Yes, post the part of the script where you declare $sFilePath1 - a list of includes does not really help anyone. :rolleyes:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
sammy1983

sammy1983,

 

Yes, post the part of the script where you declare $sFilePath1 - a list of includes does not really help anyone. :rolleyes:

M23

 

While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $btn
GUISetState(@SW_HIDE)
Local Const $sMessage = "Please select the file"
Local $sFilePath1 = FileOpenDialog($sMessage, @WindowsDir & "", "Excel file (*.xls;*.xlsx)", $FD_FILEMUSTEXIST)
If @error Then
; Display the error message.
MsgBox($MB_SYSTEMMODAL, "Info", "No file(s) were selected. Task abandoned.")
Exit
EndIf
ExitLoop
EndSelect
WEnd
 
Local $oExcel = _ExcelBookOpen($sFilePath1, 0, 0) ; Opens an existing excel File
 
Output:
---------
 
"D:DesktopTest.au3" (62) : ==> Variable used without being declared.:
Local $oExcel = _ExcelBookOpen($sFilePath1, 0, 0)
Local $oExcel = _ExcelBookOpen(^ ERROR
Edited by sammy1983

Share this post


Link to post
Share on other sites
Melba23

sammy1983,

And how do you get to the Local $oExcel = _ExcelBookOpen($sFilePath1, 0, 0) line which is giving you the problem? Posting the whole script might be a good idea or we will be here all night. ;)

M23

P.S. When you post code please use Code tags - see here how to do it. :)


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites
sammy1983

Found the glitch!!!

After  Case $msg = $GUI_EVENT_CLOSE, instead of using ExitLoop, tried just Exit and it worked. Thanks Melba.  :bye:

Share this post


Link to post
Share on other sites
sammy1983

sammy1983,

And how do you get to the Local $oExcel = _ExcelBookOpen($sFilePath1, 0, 0) line which is giving you the problem? Posting the whole script might be a good idea or we will be here all night. ;)

M23

P.S. When you post code please use Code tags - see here how to do it. :)

 

Sure. Now I got to know how to post the code. Will follow henceforth. You know I am a newbie. :-)

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  

×