G. Roderick Singleton wrote:
I have spent some time this weekend examining your problem and think the
best way might be a macro to extract the URLS. Here is one cobbled
together for you to try. It is untested so use only on a copy of
the .ods file you create from your original.
<snip>
I am no a macro coder so this assumes that the spreadsheet has an empty
column to the right of the column with the linked text into which the
macro can place the URL. Please have a look at the HYPERLINK function as
well just in case you need it.
I took a look at your macro and I made a few changes. The macro now
accepts a single argument, which is the selection. If multiple ranges
are selected, then it calls itself for each selection. Also, I declared
all of the variables.
Sub extract_1st_HyperlinkURL_to_RightNeighbour(oSels)
Dim oSheet
Dim oEnum
Dim oSourceCell
Dim oTargetAddr
Dim oTargetCell
Dim URL
Dim i
If oSels.supportsService("com.sun.star.sheet.SheetCellRanges") Then
For i = 0 To oSels.getCount() - 1
extract_1st_HyperlinkURL_to_RightNeighbour(oSels.getByIndex(i))
Next
Exit Sub
End If
oSheet = oSels.SpreadSheet
oEnum =
oSels.queryContentCells(com.sun.star.sheet.CellFlags.STRING).getCells().createEnumeration()
While oEnum.hasMoreElements()
oSourceCell = oEnum.NextElement
oTargetAddr = oSourceCell.CellAddress
oTargetCell =
oSheet.getCellByPosition(oSourceCell.CellAddress.Column+1,oSourceCell.CellAddress.Row)
If oSourceCell.Textfields.Count >0 Then
URL = oSourceCell.Textfields.getByIndex(0).URL
oTargetCell.setString(URL)
EndIf
wend
End Sub
I used the macro, almost exactly as it was. Interesting idea to use
queryContentCells; smart!
Now you can even call this with the entire sheet!
Dim oSels
oSels = ThisComponent.CurrentController.Selection
'extract_1st_HyperlinkURL_to_RightNeighbour(oSels)
extract_1st_HyperlinkURL_to_RightNeighbour(ThisComponent.sheets(0))
I added no extra error checking, such as verifying a Calc document, etc...
--
Andrew Pitonyak
My Macro Document: http://www.pitonyak.org/AndrewMacro.odt
My Book: http://www.hentzenwerke.com/catalog/oome.htm
Info: http://www.pitonyak.org/oo.php
See Also: http://documentation.openoffice.org/HOW_TO/index.html
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]