Masum

ExcelRangeRead intermittent error

3 posts in this topic

Hi all,

I'm facing a random error, whereby the ExcelRangeRead function is storing the first letter of a string as a lowercase rather than the uppercase it is stored in Excel. This happens about 10% of the times. And only with one of the ExcelRangeRead functions below, Global $RTERuleName = _Excel_RangeRead($oWorkbook, 'CHFT Pools & RTE Rules', 'I' & $Row)

Func ExtractDCWData()
    Global $PoolName = _Excel_RangeRead($oWorkbook, 'CHFT Pools & RTE Rules', 'G' & $Row)
    Global $PoolDescription = _Excel_RangeRead($oWorkbook, 'CHFT Pools & RTE Rules', 'H' & $Row)
    Global $RTERuleName = _Excel_RangeRead($oWorkbook, 'CHFT Pools & RTE Rules', 'I' & $Row)
    Global $FirstName = _Excel_RangeRead($oWorkbook, 'CHFT Pools & RTE Rules', 'F' & $Row)
    Global $LastName = _Excel_RangeRead($oWorkbook, 'CHFT Pools & RTE Rules', 'E' & $Row)
    Global $Notes = _Excel_RangeRead($oWorkbook, 'CHFT Pools & RTE Rules', 'L' & $Row)
    Sleep(200)
EndFunc   ;==>ExtractDCWData

The excel column looks like this.

Capture.PNG

The script that writes the data out is as follows.

Func AddRTERule()
    MouseClick('Primary', 69, 657, 1) ;Click Rules...
    Sleep(200)
    MouseClick('Primary', 363, 228, 1) ;Click Type
    Sleep(200)
    MouseClick('Primary', 363, 266, 1) ;Click RTE
    Sleep(200)
    MouseClick('Primary', 363, 545, 1) ;Click New Rule
    Sleep(200)
    Send($RTERuleName) ;Enter Mnemonic
    Sleep(200)
    Send('{TAB}') ;Enter Description
    Sleep(100)
    
    ;Theres more lines of code in this function...
    
EndFunc   ;==>AddRTERule

Any ideas?

 

Share this post


Link to post
Share on other sites



What you get from _Excel_RangeRead is the RAW VALUE of the cell. What you see on the screen is the FORMATTED VALUE.
Make sure that there is no formatting rule on the cells setting the first letter to uppercase.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2016-08-18 - Version 1.4.6.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2016-12-04 - Version 1.2.2.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thanks there shouldn't be, but I'll clean it all up and try again.

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

  • Similar Content

    • ZeroByDevide
      variables
      By ZeroByDevide
      i have this code running but it just would not start the code:
      Local $rndSleep = Int (Random(180000,240000,1000))
      MsgBox($MB_SYSTEMMODAL, "NaaaNuuu", "This message box will show the sleeptime after closing the tabs, you got " & $rndSleep & " seconds left.", $rndSleep)
       
      here is the error it shows me:
      "C:\Users\numan\Desktop\scipiie.au3" (23) : ==> Variable used without being declared.:
      MsgBox($MB_SYSTEMMODAL, "NaaaNuuu", "This message box will show the sleeptime after closing the tabs, you got " & $rndSleep & " seconds left.", $rndSleep)
      MsgBox(^ ERROR
    • greenfield
      To get the right linenumber from Autoit Error POPUP window
      By greenfield
      I am using autoit script for CLI.  When I execute autoit script as execution file, I found error message such as below images.
      But line number is different with real line number of my script. Real line number is 28.  How to get the right line number from Autoit error ?
      Thanks
       
       

    • Ambient
      Error When running complied Script
      By Ambient
      Okay guys, I have written a script which essentially runs once a week to copy files to a server. It also copies the files to a local directory. When I run in Autoit it works perfectly. When I compile and run I get the attached error. Any help would be appreciated. How should I debug this? I am not a programmer by the way but  love Autoit as it has done so much for me.

    • AJB
      "Error: Variable must be of type object" on new machine
      By AJB
      Hello,
      I've been using autoit for about a year now and overall it's been great despite my limited understanding of all of its features. I have several scripts that run on virtual machines that have been running smoothly for several months without any issues. Recently, I had to create new virtual machines and migrate my scripts over and now I am getting errors that I can't seem to repeat, but seem to happen at least once a day with all of my executables that were flawless before.
      The error that I keep getting is:
      Autoit Error
      Line [this number varies per script] (File "[path to my executable]"); Error: variable must be of type object.
      I  never received this error before until I moved everything to the new VMs, and when I rerun my scripts after clearing the error everything seems to work and run fine until hours later or sometimes the next day. I am assuming that that the root cause may be in some kind of settings on the VM itself since it is happening nearly across the board, but I have no idea where to even look. These are running on Windows 7, which is what they were running on before I had any errors.
      The only consistent include used in these scripts is  IE.au3
      Has anyone run into a similar problem or can maybe point me in the right direction. I am at the point of pulling hair out trying to resolve this. I have even rewritten and re-compiled the scripts to see if somehow the executables got corrupted, but that didn't help.
      Thank you.
    • WalterBaeckelmans
      _AD_Open() error
      By WalterBaeckelmans
      I use _AD_Open() in a script and a strange thing happens. The first time I logon to a computer with an active directy user login the _AD_Open() function gives @error=4 with no description of the @extended error. It just says LDAP Provider generated the error. When I log off the workstation and than log on with the same user login name the function _AD_Open() works perfectly. It seems that if the workstation has a profile of the user on the local PC, _AD_Open() works correctly but if the profile of the login user does not yet exist it gives the error. Any suggestions? I would like to make it work the first time a user logs on on a not yet used workstation. Much thx in advance for your advice.
      P.S. I love the AD-extensions to Autoit; they work prefectly in the (mostly logon ) tools I've written for our domain workstations.