2013/3/9 Andrew <apb5653@bak.rr.com>:
On 3/9/2013 12:42 PM, Johnny Rosenberg wrote:
I now have the problem Miroslaw has already commented on - star office
vs.
VBA. Ouch. I've received "Basic runtime error 1". Is there a
translation
guide?
I'm not sure, I don't think so. I have never tried to load an Excel
macro in LibreOffice and I didn't use Excel since I don't know when,
2006?
Does it look like LibreOffice has tried to translate the macro somehow
or does it look exactly like the original Excel macro?
What does the line look like that currently is producing an error? Are
there many lines like that?
Andrew Pitonyak's macro document is a good start if you want to learn
LibreOffice Basic macro programming. Search for AndrewMacro and you
will find a PDF and an ODF (same document, different formats).
Installing something called ”xray” is also a very good idea. It's a
macro that helps you investigate objects, for example cell ranges,
selections and much more.
If you just want to know a couple of simple things, like how to get
and set properties for a cell range, you can ask here if you can't
find the answer by searching.
Johnny Rosenberg
This is not just a simple one line macro, this is a program of
relatively
large proportion - I estimate hundreds of lines of code. And I have
others I
will probably need to do the same.
By the way, it sure would be nice if I could copy & paste error messages
directly from the error dialogs (the same way I was able to copy & paste
the
version string), instead of having to retype them.
I have this sinking feeling that converting to star basic is a step
backwards in time, not forward.
Then you should keep using Excel.
Is there any other *current* program this
BASIC is compatible with?
Apache OpenOffice, pretty much anyway (same Basic, maybe 99 % same API).
Or does this lock me into LibreOffice?
Yes, maybe a little bit. As you are already locked into Excel, maybe
your best choice is to continue using Excel.
Maybe I'd
be better off converting to java if I'm going to do a major rewrite?
Maybe the differences/changes are minor. I looked at the macro guide you
mentioned and... well, it seems like it's a whole different language.
Well, the language is basically (!) the same (not 100 % though), the API isn't.
Here is the first thing it errored out on. The "set rng=" statement. I
include the entire subroutine so that you have some context. Since this is
the entry point to my program I suppose you could just copy & paste it to
your own empty file called "newinputs.xls" and see what happens when you run
it. Thank you
Private Sub UserForm_Initialize()
Dim rng As Range
Dim myPath As String
Dim appl As String
Dim myName As String
Dim lastRow As Integer
Dim lastColumn As Integer
Dim pro As Worksheet
”As Range” and ”As Worksheet” doesn't exist in LibreOffice Basic (nor
does it exist in Apache OpenOffice Basic, nor StarBasic).
Usually you declare those ”As Object”.
'frmPropertyEntry.Hide
dWidth = Me.Height
appl = "newinputs.xls"
myPath = ActiveWorkbook.Path
myName = ActiveWorkbook.Name
If myName <> appl Then
MsgBox "I'm confused! Please close " & myName & " before trying to run
" & appl
Exit Sub
End If
Set pro = ThisWorkbook.Worksheets("Processed")
pro.Activate
lastRow = pro.UsedRange.Rows.count
lastColumn = pro.UsedRange.Columns.count
*Set rng = pro.Range("b2", pro.Cells(lastRow, lastColumn).Address)*
The API is very different, so this line needs to be totally reworked.
So does most of the lines.
Excel for you, I guess. Or a lot of work…
frmPropertyEntry.PropertyInfo.RowSource = vbNullString
frmPropertyEntry.PropertyInfo.RowSource = rng.Address
page = "Processed"
Set rng = Nothing
Set pro = Nothing
'frmPropertyEntry.Show (vbModeless)
End Sub
--
For unsubscribe instructions e-mail to: users+help@global.libreoffice.org
Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted
Context
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.