Clarification with macro (selecting a range)

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
namar
Posts: 5
Joined: Thu Jul 17, 2008 6:58 pm

Clarification with macro (selecting a range)

Post by namar »

Hi,
Could you please let me know the name of the macro function,which will return the address referance of selected cell range...

m = ActiveWindow.RangeSelection.Address

The above mentioned function ,will return the address range of slected(multiplecells) to M.
but this funtion is working only in MS EXCEL...

Thanks
namar
OOo 2.2.X on Ms Windows XP
User avatar
probe1
Volunteer
Posts: 277
Joined: Mon Oct 08, 2007 1:34 am
Location: Chonburi Thailand

Re: calrification with macro(selecting a range)

Post by probe1 »

wrong section: question should have been posted in Customizing and Extending>Macros and UNO API


To learn about StarBasic -which is different from Excel's VBA- see:
Andrew's Macro Document

Good luck!
Cheers
Winfried

DateTime2 extension: insert date, time or timestamp, formatted to your needs
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: calrification with macro(selecting a range)

Post by Villeroy »

Moved to API forum.
Short answer: Nothing guarantees that the current user has a single range selected. It could be a multiple range selection or some type of shape. Another thread mentioning th exray tool, the SDK and linking to another thread about the active cell and it's address:
http://user.services.openoffice.org/en/ ... ges#p33942
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
namar
Posts: 5
Joined: Thu Jul 17, 2008 6:58 pm

Re: calrification with macro(selecting a range)

Post by namar »

Hi,
I tried to run n the the below mentioned script in the "open office calc"... But it's gives an error message ,when the control the reaches on
the statment "xray oCell"

The errror message is "Basic runtime error" sub procuedure or function procedure not defined....

Could you please help me.....


Sub Main
oDoc = thisComponent
oSheet = oDoc.Sheets.getByIndex(0)
oCell = oSheet.getCellByPosition(0, 0)
GlobalScope.BasicLibraries.loadLibrary("XrayTool")
xray oCell
oNote = oCell.getAnnotation() 'or pseudo-property .Annotation
xray oNote
oNote.setString("Hello, Note") 'or pseudo-property .String
End Sub
----------------------------------------------------------
OOo 2.2.X on Ms Windows XP
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: calrification with macro(selecting a range)

Post by Villeroy »

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
namar
Posts: 5
Joined: Thu Jul 17, 2008 6:58 pm

Re: calrification with macro(selecting a range)

Post by namar »

Hi,
I have done the installation of XRAy and I have put the below mentioned code ,just above macro code which i had sent earlier,But when i ran it,I am getting another window as mentioned in the attached file...

Sub Main
Xray ThisComponent
End Sub

Could you please let me know how do i go further???
Attachments
untitled.zip
(32.41 KiB) Downloaded 234 times
OOo 2.2.X on Ms Windows XP
User avatar
probe1
Volunteer
Posts: 277
Joined: Mon Oct 08, 2007 1:34 am
Location: Chonburi Thailand

Re: Clarification with macro (selecting a range)

Post by probe1 »

Your BMP indicates the you have run a xray oCell statement - this window is the Xray Tool.

Now you can browse the properties (and their values) and (possible) methods of the object under inspection.

Get Andrew's free macro document and read it.
It helped me (and many others) a lot to understand StarBasic.
Cheers
Winfried

DateTime2 extension: insert date, time or timestamp, formatted to your needs
Post Reply