prasadstudy Posted September 12, 2017 Share Posted September 12, 2017 I am getting the following error "Variable used without being declared" while using the below Global $OpenExcel=_Excel_Open() Global $ReferenceWorkBook=_Excel_BookOpen($OpenExcel,$Referencepath,$bVisible=False) Code seems to be fine according to me and not sure why this error keeps popping up. Any assistance? Link to comment Share on other sites More sharing options...
Danp2 Posted September 12, 2017 Share Posted September 12, 2017 The variable $bVisible came from the help file header; it doesn't exist in your code. Try changing your code to Global $ReferenceWorkBook=_Excel_BookOpen($OpenExcel,$Referencepath,False) Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
prasadstudy Posted September 13, 2017 Author Share Posted September 13, 2017 Thanks @Danp2 for the reply!!! What I wanted is to open an excel sheet and make it invisible (Running behind current active window). Per your assistance, I had tried with marking it as "False" directly but excel sheet did not go behind current active window. Also, having an another query, if we pass directly as "False" in the argument, then how does system understands that this argument is for $bVisible and not for $bReadOnly? _Excel_BookOpen ( $oExcel, $sFilePath [, $bReadOnly = False [, $bVisible = True [, $sPassword = Default [, $sWritePassword = Default [, $bUpdateLinks = Default]]]]] ) I tried again by matching with above format but ended up with error messages only. Global $ReferenceWorkBook=_Excel_BookOpen($OpenExcel,$Referencepath,,False) - Error in expression. Global $ReferenceWorkBook=_Excel_BookOpen($OpenExcel,$Referencepath,[,[,False]]) - Error in expression. Link to comment Share on other sites More sharing options...
Developers Jos Posted September 13, 2017 Developers Share Posted September 13, 2017 You can't skip providing a parameter by just providing a comma. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted September 13, 2017 Moderators Share Posted September 13, 2017 (edited) You cannot leave parameters blank, you have to put in either True or False (or the Default keyword) for the $bReadOnly param: #include <Excel.au3> Local $oExcel = _Excel_Open() Local $oWorkbook = _Excel_BookOpen($oExcel, @DesktopDir & "\Test.xlsx", Default, False) Sleep(1000) _Excel_BookClose($oWorkbook) _Excel_Close($oExcel) Edited September 13, 2017 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
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