OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Problems installing new macro library

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
richhill
OOo Advocate
OOo Advocate


Joined: 16 Jun 2004
Posts: 418
Location: Mesa, AZ

PostPosted: Wed May 18, 2005 9:34 am    Post subject: Problems installing new macro library Reply with quote

I have just released an add-in library for extended precision math. It is a port of XNumbers - orininally developed on Excel/VBA.

It can be picked up at the link below.
http://www.richhillsoftware.com

However, I was unable to integrate the macro library installer with this and I continue to
have problems using this new library after manual installation. I get #VALUE errors all the time.

I presume this is just lack of experience on my part - but any help with this would be greatly appreciated.

Dave
Back to top
View user's profile Send private message Visit poster's website
B Marcelly
Super User
Super User


Joined: 12 May 2004
Posts: 1145
Location: France

PostPosted: Thu May 19, 2005 1:55 am    Post subject: Reply with quote

Several users have recently asked here questions about libraries for Calc functions.
I did some tests (OOo 1.1.3) and I think there are several bugs around here.

Apparently, the only reliable way is to put your function definitions in modules belonging to Standard library. Using the Standard library from soffice would be better.
In order to avoid collisions of names with variables in other modules of Standard library, you should have more complex names for your public constants and for some routines like "about" routine.

To avoid other problems it would be better to put the macro library in an installation document separate from the Calc demo. The installation document need not be a Calc doc, could be Writer. It will only be used to install and closed after.

Currently all your functions are stored in one module (badly named Basic, you are looking for troubles!). It would be better to spread them in several modules.
It will be necessary anyway because there is a limit of about 64000 characters per module.
Having separate modules implies two changes. The variables and constants declared outside a Sub or Function must be PUBLIC. Declare them like this in the first of your modules:
Code:
Public Const base_ = 5
Public Const DM_ = 10 ^ base_
Public Const Default_Digits_ = 75
Public Const DecSep = "."

Public digit_max

You are using a type definition, but here Basic does not support Public. You will have to copy the same definition at top of each of the other modules.

I created 3 modules and did all these changes then tested with xadd. The function ran without error. Result was false but it may be due to my Locale : using the comma as decimal separator.

Installation of your Xnumbers modules could be done with a macro contained in the installation document and started from a form button.

Hope this helps
______
Bernard
Back to top
View user's profile Send private message Visit poster's website
Gore
General User
General User


Joined: 13 May 2005
Posts: 13
Location: Andalucía

PostPosted: Thu May 19, 2005 12:20 pm    Post subject: Reply with quote

Dave,
very interesting your Xnumber library. For long time I was searching something similar for my work. A question, is possible go up the number of digits set for the xnums?

In that concerns the #VALUE and #NAME error I have a similar problem with locked libraries.
See http://www.oooforum.org/forum/viewtopic.phtml?t=20238

I have added this code to the standard library of my copy of XNumbers_01.sxc and assigned the macro "Load_Library" to the document event "Open document" and all seems work. The #NAME erros disappear and the new arithmetic is prompt for new calls.

Code:
Sub Bluff
   dim oCellAddress as new com.sun.star.table.CellAddress
   oCellAddress.Sheet = 1
   oCellAddress.Column = 0
   oCellAddress.Row = 0

   if not ThisComponent.namedRanges.hasByName("pqrst") then
      ThisComponent.namedRanges.addNewByName("pqrst", "", oCellAddress, 0)
   endif
   ThisComponent.namedRanges.removeByName("pqrst")
End Sub

Sub Load_Library
   dim sc as string
   sc = "Xnumbers"
   if not BasicLibraries.isLibraryLoaded(sc) then
      BasicLibraries.loadLibrary(sc)
      Bluff
   endif
End Sub


I hope that serves you.
_________________
Elías
Back to top
View user's profile Send private message
richhill
OOo Advocate
OOo Advocate


Joined: 16 Jun 2004
Posts: 418
Location: Mesa, AZ

PostPosted: Sat May 21, 2005 3:26 pm    Post subject: Reply with quote

Elias and Bernard,

Thank you very much for your responses. I would have replied earlier - except I became afflicted with bronchitis and the medication make me want to do nothing except sleep and feel bad Sad I am almost recovered but still a week more of antibiotics.

Anyway, I'll review your suggestions and update my download/install instructions.

All the best!

Dave
_________________
OOo Calc tips: http://www.openofficetips.com
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group