I am converting a VBA app to run with open office. In the VBA app I had code that places the current cells row and column number in a cell for later use. The code was triggered by the sheet selection change event.
Now I have adapted the macro to run in oo but when I attach it to the sheet event selection change it give me an error when the user clicks on a non cell (menu item, column/row heading ect) as well as when the mouse is over a non cell object.
Am I asking to much?
[Sub cursor_positon
Dim oCell,oSheets,oSheet,oDoc,cellText
Dim Cell As Object
Dim oCells
dim row as integer
dim column as integer
dim oRow as integer
dim ocolumn as integer
dim tempstring as string
oController = ThisComponent.getCurrentController()
oDoc = ThisComponent
oCell = oDoc.getCurrentSelection
oSheet = oDoc.Sheets.getByName("sheet1")
iCol1= oCell.CellAddress.Column
iRow1= oCell.CellAddress.Row
oCell = oSheet.getCellrangebyname("a3") rem column number
oCell.String = iCOL1
oCell = oSheet.getCellrangebyname("b3")
oCell.String = irow1
END SUB code][/code]
I inserted the code for review.
Active cell and selection change event
Active cell and selection change event
Open Office 4.1 on Windows 10
Re: Active cell and selection change event
You must examine first if the oCell object IS a cell really or not:
Install and use the MRI or the XrayTool for study the programming objects of the office suite.
Code: Select all
If oCell.ImplementationName = "ScCellObj" then
...
else
...
end if
Install and use the MRI or the XrayTool for study the programming objects of the office suite.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
[solved] Re: Active cell and selection change event
Thanks that did it.
Youre a real help
Thanks
Youre a real help
Thanks
Open Office 4.1 on Windows 10
Re: Active cell and selection change event
Unfortunately, there is no direct API function to get the active cell. If you search this forum for "getActiveCell" you will find a user defined Basic function which reads the active cells position from a "ViewData" string.
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
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice