[Solved] Search descriptor different behaviour on new PC

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
john_forver
Posts: 2
Joined: Fri Nov 20, 2015 10:16 pm

[Solved] Search descriptor different behaviour on new PC

Post by john_forver »

I have a macro that I use on one PC running windows 7 with LibreOffice 4.4.6.3, it works quite well and does the job.

I wanted to use the same macro on a Linux PC running Ubuntu, initially it had LibreOffice 4.2.something and the macro did not work with the below error, I removed this version and installed 4.4.6.3 on the Linux machine thinking this was the use but I still have the same problem.

Everytime I exdecute the macro on the Linux PC I get the error "Object variable not set" pointing to the line "Num_Found = Search_Result.Count"

Here is the code that works fine on the first PC and causes the error on the second:

Code: Select all

oSheet = eSheets.nextElement()
		ColA = oSheet.getCellrangeByName("A1:A65536")
		Search_Desc = ColA.createSearchDescriptor()
		Search_Desc.SearchString = "Script #:"
		Search_Result = ColA.findAll(Search_Desc)
		Num_Found = Search_Result.Count
		Last_Occur = Search_Result.getByIndex( Num_Found - 1)
		CellAddr = Last_Occur.CellAddress
		oRow = CellAddr.Row
		oCol = CellAddr.Column
		NewCell = oSheet.getCellByPosition(oCol + 1, oRow)
		NewCell.String = "TEST_TEST"
Many thanks.
Last edited by Hagar Delest on Thu Dec 24, 2015 6:57 pm, edited 2 times in total.
Reason: tagged solved
FJCC
Moderator
Posts: 9626
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Search descriptor different behaviour on new PC

Post by FJCC »

The macro works for me on both Windows and Linux using OpenOffice 4.1.2. Can you post a file for which it does not work on Linux?
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
john_forver
Posts: 2
Joined: Fri Nov 20, 2015 10:16 pm

Re: Search descriptor different behaviour on new PC

Post by john_forver »

Thanks for checking, I tried with another file and it actually works fine on the Linux host. So it is not the macro I will check the original file...

I guess I need to add some error handling to my first macro :)
OpenOffice 4.4.6 on Ubuntu
Post Reply