Sign in to follow this  
Followers 0
pedrosojones

Error: Variable must be of type "Object"

3 posts in this topic

#1 ·  Posted (edited)

Hi,

Can you help me for the following error:

(9) : ==> Variable must be of type "Object".:

$oExcel.Range("A"&$2i).Select

$oExcel^ ERROR

#include <File.au3>
#include <Excel.au3>
$oExcel = _ExcelBookOpen("C:\Program Files\DIGIT APPS\CLEAN\Clean_log.xls")
    $today = (@MDAY & "/" & @MON & "/" & @YEAR)
    $time = (@HOUR & ":" & @MIN)
 
    For $2i = 1 To 2000 ;Loop
        $oExcel.Range("A"&$2i).Select
         if $oExcel.Application.ActiveCell.Value = "" then 
           _ExcelWriteCell($oExcel, $today , $2i , 1)
           _ExcelWriteCell($oExcel, $time, $2i , 2)
           _ExcelWriteCell($oExcel, @ComputerName, $2i , 3)
           _ExcelWriteCell($oExcel, @UserName, $2i , 4)
           ;_ExcelWriteCell($oExcel, $Newuser, $i , 4)
            exitloop
        EndIf
     Next
            MsgBox(0, "Exiting", "Press OK to Save File and Exit") 
           _ExcelBookSave($oExcel) ;Save File With No Alerts
           _ExcelBookClose($oExcel) ; And finally we close out

Thank you

Edited by pedrosojones

Share this post


Link to post
Share on other sites



it's possible $oExcel didn't open properly. Replace

$oExcel = _ExcelBookOpen("C:\Program Files\DIGIT APPS\CLEAN\Clean_log.xls")

with

$oExcel = _ExcelBookNew()

And see if you still get the same error?

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  
Followers 0