Jump to content
lampel

excel udf - error variable must be of type object

Recommended Posts

lampel

hello all ,

i am a begginer at autoit , 

i have created an autoit script that creates a new excel file and i edit that excel sheet according to certin parameters , 

the script works fine in computers that have excel 2007 2010 

but when i try to run the script on a diffrent cumputer that has excel 2013 (mybe its that perticular cumputer issue and not excel version issue)

excel sheet opens and then i get the following error (see attachment) 

"error : Variable must be of type "object"  line "4233"

this is the start of my script that i think the problem is  ( i am not sure) the whole script is over 1000 lines .

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=..\pic\images.ico
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Excel.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <File.au3>
#include <MsgBoxConstants.au3>
#include <Math.au3>
; Create application object and create a new workbook
Local $openExcel = _Excel_Open()
If @error Then Exit MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example", "Error creating the Excel application object." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
Local $excelObject = _Excel_BookNew($openExcel)
If @error Then
    MsgBox($MB_SYSTEMMODAL, "Excel UDF: _Excel_RangeWrite Example", "Error creating the new workbook." & @CRLF & "@error = " & @error & ", @extended = " & @extended)
    _Excel_Close($openExcel)
    Exit
EndIf

i am using autoit 3.3.14

can some one help me with this ? 

 

thanks lampel

Untitled.jpg

Edited by lampel

Share this post


Link to post
Share on other sites
Sori

Have you tried running the AU3 file instead?
It's usually much easier to find the error with Autoit, rather than an exe


If you need help with your stuff, feel free to get me on my Skype.

I often get bored and enjoy helping with projects.

Share this post


Link to post
Share on other sites
lampel

hello Sori , 

i have installed office 2013 in my computer to see this bug , 

when i first lunched the exe file i had the exact same issue . (with office 2010 - no issues at all)

when i run the script with F5 all works well

when i compile it and try to run the exe i get the error

 

thanks lampel

Share this post


Link to post
Share on other sites
water

Include the Excel UDF as the first file and the line number you get in the error message will be the line number in the Excel UDF.

#include <Excel.au3>
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <DateTimeConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <File.au3>
#include <MsgBoxConstants.au3>
#include <Math.au3>

 


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.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
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

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

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.