O'Reilly logo

Learn OpenOffice.org Spreadsheet Macro Programming by Dr. Mark Alexander Bain

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Processing Web Pages

To start with a question—how do you get a macro to open a blank Calc document? Hopefully, you'll answer that you use the function that we wrote in Chapter 6 :

Function open_spreadsheet
Dim oURL as String
oURL = "private:factory/scalc"
open_spreadsheet = starDeskTop.loadComponentFromURL (oURL, _ "_blank", 0, Array() )
End Function

So here's another question—How do you get a macro to open a blank Writer document? Not sure? Let me give you a clue—you can use the same subroutine, but you have to change one word. Give up? Just change:

oURL = "private:factory/scalc"

To:

oURL = "private:factory/swriter"

From this I'm sure you can deduce that it's the URL that determines how a file is opened; this is true ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required