Use macro to insert character without font info in Writer

In Writer, I recorded a simple macro to insert an en dash so that I can assign that to a key combination (Alt-n). However, when I use it, it uses the font the text was in when I recorded it.

  1. How can I strip out the font information, so that the macro inserts a generic en dash in whatever font is in use at the point of insertion?

  2. The macro I recorded is below, but I’m sure there’s a simpler, better version. Any suggestions appreciated.

    sub enDash
    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(1) as new com.sun.star.beans.PropertyValue
    args1(0).Name = “Symbols”
    args1(0).Value = “–”

    dispatcher.executeDispatch(document, “.uno:InsertSymbol”, “”, 0, args1())

    rem ----------------------------------------------------------------------
    rem dispatcher.executeDispatch(document, “.uno:InsertSymbol”, “”, 0, Array())

Try:

doc = ThisComponent	
cursor = doc.CurrentController.ViewCursor
doc.Text.insertString(cursor, Chr(8210), False)