Page 1 of 1

OOo Code Sheet Gives Error if password protected

Posted: Wed Oct 19, 2011 9:24 am
by saurabh42s
Hi Guyz,
Please help me ASAP. This is an urgent issue in our project.
My Problem is that i have a sheet, When i protect the code by providing a password then it gives an error "Basic Runtime Error : sub procedure or function procedure not defined". There are 6 tabs in this sheet out of which 4 tabs have add-delete functions so that rows can be added or deleted as per the requirement. Now all is working fine but this runtime error : sub procedure or function procedure not defined is troubling me a lot. When the code is not password protected then the error does not appear.

NOTE: I am using OpenOffice Version 3.3

I am attaching the sheet for refernce.
FORM VAT 11A.zip
(127.56 KiB) Downloaded 437 times
Please help me

password is : formvat11a

Re: OpenOffice Sheet Gives Error When i protect macro with p

Posted: Wed Oct 19, 2011 10:58 am
by Zizi64
How we would be able to help you?
We do not know the password ...
We can not see the macro code...

Re: OpenOffice Sheet Gives Error When i protect macro with p

Posted: Wed Oct 19, 2011 11:44 am
by saurabh42s
ok, password is : formvat11a

Re: OpenOffice Sheet Gives Error When i protect macro with p

Posted: Wed Oct 19, 2011 11:54 am
by B Marcelly
Hi,
Sorry, we don't have a crystal ball. :ucrazy:
Your spreadsheet sheets are protected.
Your macro library is protected.
You don't give us the passwords.
You don't provide any indication of the code where the error appears (you could insert some MsgBox instructions to find out).

I can only see that the library contains many modules with many Sub/Function, and the spreadsheet probably has an Excel origin.

Create a simplified version. Suppress code, suppress sheets, simplify, simplify, until the origin of the problem becomes obvious. That is debugging, the daily chore of a programmer.

Re: OpenOffice Sheet Gives Error When i protect macro with p

Posted: Wed Oct 19, 2011 12:09 pm
by saurabh42s
i have already given the password for this sheet..(ie : formvat11a)
When You open the spreadsheet then there comes a msgbox saying please do not cut paste any value in the sheet.
Now Error comes immediately after Pressing OK button of the Msgbox and it says "Basic Runtime Error : Sub Procedure or Function procedure not defined."
And most important thing, this error will come only in OpenOffice Version 3.3

Re: OpenOffice Sheet Gives Error When i protect macro with p

Posted: Wed Oct 19, 2011 12:16 pm
by saurabh42s
The reason for protecting macro library is that the error comes only when our macro library is protected.
We have to protect our code because this spreadsheet is of taxation framework and thousands of dealers will be entering their data in it sometime.

Re: OOo Code Sheet Gives Error if password protected

Posted: Wed Oct 19, 2011 1:55 pm
by hanya
It seems VBASupport 1 does not work with password locked library. I got error on Range function. So, re-write without VBASupport or work with un-locked library. I got the same error on LibreOffice 3.4 also.

Re: OOo Code Sheet Gives Error if password protected

Posted: Wed Oct 19, 2011 1:58 pm
by saurabh42s
We can't use Unlocked Library .We have to lock our library.

Re: OOo Code Sheet Gives Error if password protected

Posted: Wed Oct 19, 2011 2:05 pm
by saurabh42s
Mr. Andrew Pitonyak, Can you help me out in this???
Or AnyOne Please....

Re: OOo Code Sheet Gives Error if password protected

Posted: Wed Oct 19, 2011 3:05 pm
by Villeroy
Why don't you simply use Excel with VBA code?

Re: OOo Code Sheet Gives Error if password protected

Posted: Wed Oct 19, 2011 3:07 pm
by saurabh42s
Dude, we have the same thing with Excel Also, but with Open Office is the requirement of our Client.
So, i was forced to make these sheets in OpenOffice.
:(

Re: OOo Code Sheet Gives Error if password protected

Posted: Wed Oct 19, 2011 3:32 pm
by Villeroy
And now we should do your job or what?
Rewrite the program or tell your client that it is not profitable to do that.
 Edit: The code has been re-written already. There is no need to run it with "Option VBASupport 1".
Apart from that, I don't see any reason to protect such trivial crap. 

Re: OOo Code Sheet Gives Error if password protected

Posted: Wed Oct 19, 2011 3:36 pm
by RoryOF
Debug it. Either it works with the password or it doesn't; if it doesn't then too bad - raise an issue for OOo developers.
 Edit: useful info on macro passwords at
http://user.services.openoffice.org/en/ ... =20&t=8043
http://user.services.openoffice.org/en/ ... f=20&t=954 

Re: OOo Code Sheet Gives Error if password protected

Posted: Wed Oct 19, 2011 4:55 pm
by hanya
Unfortunately, this short code does have problem in password protected library.
Library1.Module1

Code: Select all

Option VBASupport 1
Sub Main
  Range("A1").Value = 100
End Sub
Gets sub-procedure or function procedure not defined.

Re: OOo Code Sheet Gives Error if password protected

Posted: Wed Oct 19, 2011 5:09 pm
by Villeroy
hanya wrote:Unfortunately, this short code does have problem in password protected library.
Someone started the conversion process but did not finish. saurabh42s tries to find some idiot to do his job for free.

Re: OOo Code Sheet Gives Error if password protected

Posted: Thu Oct 20, 2011 6:21 am
by saurabh42s
Mr Villeroy.
I am asking here for help and not to do anyone to do my job.
You should think atleast once before saying anything.

Re: OOo Code Sheet Gives Error if password protected

Posted: Mon Oct 31, 2011 7:06 am
by saurabh42s
Guyz , any solution for this problem????

Re: OOo Code Sheet Gives Error if password protected

Posted: Mon Oct 31, 2011 8:39 am
by kingfisher
I'm very rusty on the subject but I would have thought you need to use Range.getbyName or something of that sort. Paragraph 6.3 of Andrew's macro document may help.

Re: OOo Code Sheet Gives Error if password protected

Posted: Mon Oct 31, 2011 1:50 pm
by saurabh42s
Even Range.getbyName is not working here in this case.
:(

Re: OOo Code Sheet Gives Error if password protected

Posted: Tue Sep 12, 2017 10:14 pm
by roru
This Error description is very old (2011) but it is'nt fixed at the moment!

If you write long code (> 500 lines) in a library and protect it with a password it works good. But if you save the file and load it again, the code crash at different code lines, i.e. for example a comment line :-) :ucrazy:
There is a memory overflow in OpenOffice. You can split the code in small library parts, then it works again.

Here is a bug description: https://bugs.documentfoundation.org/sho ... i?id=92620 :knock:

In LibreOffice 5.2 they fixed the bug, but in 5.3 it appeared again :crazy:

Re: OOo Code Sheet Gives Error if password protected

Posted: Wed Sep 13, 2017 8:15 am
by RoryOF
There may be a memory size limit of 64K to OO library modules. In this posting
viewtopic.php?f=45&t=78105#p357501
Bernard Marcelly, a respected OO macro contributor, says
B Marcelly wrote: In OpenOffice Basic you should not have modules greater than about 60 000 characters. The editor accepts it, but Basic will behave strangely.