LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 05-25-2016, 03:36 AM   #1
iFunction
Member
 
Registered: Nov 2015
Posts: 248

Rep: Reputation: Disabled
Open Office Macro if a function is not called


Hi there,

I have a small application that I have written for Open Office, for basic data entry, I comprises of a main dialog box that requires an integer value that must be entered, and then two buttons. These two buttons open a small box each that accepts a string in one and an integer in another.

The program works wonderfully so long as both the buttons are used. Yet if either of the buttons aren't used, I get as Object variable not set error as a function is called as part of the data entry procedure.

Due to the way Open office uses a GUI with buttons to assign an event to a button, I can't work out how to check if it has or has not been called, so I was hoping that I could have the function called yet return either "Null" or "Empty" if the dialog box is not actually opened.

Here is the code that is causing the problem;
Code:
If TyreChange() = Null then             <---TyreChange() is my function
    TyreSet = CurrentTyres
Else
    TyreSet = TyreChange()
End If
And here is the Function that is called:
Code:
Function TyreChange()
    Dim TyreSet As String

    TyreSet = oTyreDialog.GetControl("TextField1").Text
    if TyreSet = Empty Then
        TyreChange = Null
    Else
        TyreChange = TyreSet
    End If

    oTyreDialog.endExecute()
End Function
This function is intentionally called by the uers pressing a button, and when it is called there is no problem. However, the problem arises when the button isn't pressed, but as you can see, it gets called by the program and but of course no data is entered. I have tried as you can see to set the variables to Empty or Null, but the program is still looking for an input that is not there. I am aware that one solution would be to use an error handler, I was however, wondering if there is a better way to deal with this issue.

I have listed the offending code, though if you need the rest of it I can post it there is rather a lot though. Any help on this is much appreciated.

Kind regards
iFunc
 
Old 05-31-2016, 04:56 PM   #2
petelq
Member
 
Registered: Aug 2008
Location: Yorkshire
Distribution: openSUSE(Leap and Tumbleweed) and a (not so) regularly changing third and fourth
Posts: 627

Rep: Reputation: Disabled
I've not tested because of course I don't have the whole thing but it seems to me that you've created Tyreset as a string but are treating it as an object in the rest of the function. The cell address can be empty but the string is .. well, a string so it could be "something" or "".

Last edited by petelq; 05-31-2016 at 04:57 PM. Reason: correct misspelling
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
JavaScript function disappears after getting called for once mohtasham1983 Programming 2 02-23-2021 11:15 PM
Libre Office and Open Office both fail to open MS Office documents correctly. Observed Linux - Newbie 8 07-18-2014 10:48 AM
office calc moving macro location knobby67 Linux - Software 0 09-18-2012 07:14 AM
mdio function not called.. =( rashyd80 Linux - Kernel 1 07-18-2010 05:11 AM
Open Office Calc autofill function setup like MSOffice Excell vdemuth Linux - Software 4 07-19-2009 01:27 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 11:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration