[Solved] Function to choose any cell by mouse as argument

The Application Programming Interface and the OASIS Open Document Format

[Solved] Function to choose any cell by mouse as argument

Postby srimal » Mon Oct 27, 2008 12:29 pm

Welcome beginner. What is your question or comment?
Please try to briefly and clearly tell us: What you want, What you tried, and What happened.
-----------------------------------------------------------------------------------------------------------

hi all,
I wrote a function with three argument which has assigned to any cell address and pass the value.but has a problem,
what i want:
1> select my data out put cell [D5]
2> run my function using macro
3> inside function will ask what is the cell u want as argument..then user select a valid cells by mouse
4> out put will in D5

i need to complete 3rd step.

FUNCTION:
Function volume(a, b, c)
volume = a*b*c
End Function
Last edited by srimal on Mon Oct 27, 2008 2:19 pm, edited 2 times in total.
OOo 2.4.X on Ms Windows XP + Red hat 5.0
srimal
 
Posts: 9
Joined: Thu Oct 23, 2008 9:47 am

Re: Function to choose any cell by mouse as argument

Postby Villeroy » Mon Oct 27, 2008 12:58 pm

Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27094
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Function to choose any cell by mouse as argument

Postby srimal » Mon Oct 27, 2008 1:56 pm

I tried above link ....once i select the cell range then suddenly appears a dialog box saying,

>> Title: exit macro:getTargetCellAddress
"Target needs to be on another sheet or behind/below selection"


what was cause for that?

regrds,
srimal
OOo 2.4.X on Ms Windows XP + Red hat 5.0
srimal
 
Posts: 9
Joined: Thu Oct 23, 2008 9:47 am

Re: Function to choose any cell by mouse as argument

Postby Villeroy » Mon Oct 27, 2008 2:07 pm

Read the code. It rejects to paste into the copied region.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27094
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Function to choose any cell by mouse as argument

Postby srimal » Mon Oct 27, 2008 2:18 pm

thanx i did it.It copies the cell range as it is.

regrds,
srimal
OOo 2.4.X on Ms Windows XP + Red hat 5.0
srimal
 
Posts: 9
Joined: Thu Oct 23, 2008 9:47 am

Re: Function to choose any cell by mouse as argument [solved]

Postby Villeroy » Mon Oct 27, 2008 2:32 pm

The macro copies the tiles of visible ranges to another place. In case of no hidden columns nor rows it copies the selected range.
The genreic part you need for your own stuff is
Code: Select all   Expand viewCollapse view
Private sRangeSelection$,bRangeSelecting As Boolean
'return a valid com.sun.star.table.CellRangeAddress from a user's range-selection (or Empty)
Function getRangeSelectionAddress(oController,sInitial$,sTitle$,bAutoClose as Boolean)
[...]
End Function

It returns a com.sun.star.table.CellRangeAddress if the user selected a range. It returns Basic type Empty if the user canceled. You've got to pass the spreadsheet-controller to pick from a default selection as string-address (A1:D4 or empty string), a title for the box and if a single click on the sheet is enough to close the selection box.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04, no OpenOffice, LibreOffice 6.x
User avatar
Villeroy
Volunteer
 
Posts: 27094
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany


Return to UNO API and ODF

Who is online

Users browsing this forum: No registered users and 1 guest