| View previous topic :: View next topic |
| Author |
Message |
richhill OOo Advocate


Joined: 16 Jun 2004 Posts: 418 Location: Mesa, AZ
|
Posted: Wed May 18, 2005 9:34 am Post subject: Problems installing new macro library |
|
|
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 |
|
 |
B Marcelly Super User

Joined: 12 May 2004 Posts: 1145 Location: France
|
Posted: Thu May 19, 2005 1:55 am Post subject: |
|
|
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 |
|
 |
Gore General User

Joined: 13 May 2005 Posts: 13 Location: Andalucía
|
Posted: Thu May 19, 2005 12:20 pm Post subject: |
|
|
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 |
|
 |
richhill OOo Advocate


Joined: 16 Jun 2004 Posts: 418 Location: Mesa, AZ
|
Posted: Sat May 21, 2005 3:26 pm Post subject: |
|
|
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 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 |
|
 |
|