Macro Errors - basic lang on data type 'range'

Discuss the spreadsheet application
Post Reply
freesoftwarewizard
Posts: 2
Joined: Mon Jul 27, 2009 5:42 pm

Macro Errors - basic lang on data type 'range'

Post by freesoftwarewizard »

I am trying to use several dozen macros I had for excel.

They all use a dat type called "range" (for cell ranges).

When I run the macros, i get a 'basic" syntax error: "unknown data type range"

Any ideas?

if not, any idea of an easy way to remove rows that have back-to-back duplicate data in a specific column (such as all the 'extra" record that have the same date in column A for rows 4 thru 10) ??

thanks

joe c.
OOo 3.1.X on MS Windows Vista + windows xp pro
FJCC
Moderator
Posts: 9274
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Macro Errors - basic lang on data type 'range'

Post by FJCC »

I'm not familiar with programming Excel, so I can't certain about your 'range' variable. I do know that you cannot in general port Excel macros to Calc without significant changes. OOobasic is not identical to VB and the underlying API's are just different. For example, to create an object representing a cell range in Calc using OOoBasic, the code could look like

Code: Select all

Doc = ThisComponent  'assign the current document to the variable Doc
Sheet = Doc.Sheets.getByName("Sheet1")  'get the sheet named Sheet1
Cellrange = Sheet.getCellrangeBYName("A1:A10")
Your VB code is, I'm sure, different. I posted some links to resources helpful for learning to write OOo macros in this thread
Last edited by FJCC on Tue Jul 28, 2009 2:51 pm, edited 1 time in total.
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.
freesoftwarewizard
Posts: 2
Joined: Mon Jul 27, 2009 5:42 pm

Re: Macro Errors - basic lang on data type 'range'

Post by freesoftwarewizard »

the excel macros are actually just vbasic with a few 'extras' "range' is a dimension type.

I'm not really looking to spend a lot of time learning oobasic. just don't know where to find such a basic macro for scalc

but thanks for the reply! :-)

joe c.
OOo 3.1.X on MS Windows Vista + windows xp pro
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Macro Errors - basic lang on data type 'range'

Post by Villeroy »

@ FJCC ;)
Even in VBA you've got to program (somehow :mrgreen: ). Particularly, you should know about data type "String" when calling anything by name.
getCellrangeByName("A1:A10")
:ugeek:
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
FJCC
Moderator
Posts: 9274
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Macro Errors - basic lang on data type 'range'

Post by FJCC »

Doh! Well, that's embarrassing Thanks for the catch, Villeroy! I knew that if I just typed even the simplest code directly into a response without checking it, I would make a mistake.
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.
Post Reply