Hi all,

I'm trying to write a macro that will allow me to select text, press Ctrl+K, and convert the text into a hyperlink (as MSFT Word does).

Here's the code I have so far. I want to assign the HyperlinkAttributes.Text that appears in the Format | Character | Hyperlink dialog to args1(0).Value. Can someone tell me the object property name I can use to do this assignment?

I am also looking for (without success) a clean and simple example of OOo macro code that puts and gets text data from the clipboard.

I posted this to the OOo Forums, but tthose forums seem dead?

Thanks!

sub FormatCharacterHyperlink
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(4) as new com.sun.star.beans.PropertyValue
args1(0).Name = "HyperlinkAttributes.URL"
args1(0).Value = WANT TO ASSIGN SELECTED TEXT TO THIS ELEMENT
args1(1).Name = "HyperlinkAttributes.Target"
args1(1).Value = ""
args1(2).Name = "HyperlinkAttributes.Name"
args1(2).Value = ""
args1(3).Name = "HyperlinkAttributes.VisitedFormat"
args1(3).Value = "Visited Internet Link"
args1(4).Name = "HyperlinkAttributes.UnvisitedFormat"
args1(4).Value = "Internet link"
dispatcher.executeDispatch(document, ".uno:HyperlinkAttributes", "", 0, args1())
end sub

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to