OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

Macro for save as dialog box

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
Miki
Guest





PostPosted: Tue Apr 20, 2004 2:49 am    Post subject: Macro for save as dialog box Reply with quote

HELLO!

I have to write a macro, for a save as dialog box. It should works in that order: I prees the button, then a dialog box ask me where to save a file and what type.

Anybody can help?

TNX
Back to top
Cybb20
Super User
Super User


Joined: 02 Mar 2004
Posts: 1569
Location: Frankfurt, Germany

PostPosted: Tue Apr 20, 2004 8:31 am    Post subject: Reply with quote

If you just want to get the normal Save File Dialog.
Then it's as simple as that to get it:

Code:

Sub filepickerdialog()
Dim oFileDialog

 oFileDialog = CreateUnoService( "com.sun.star.ui.dialogs.FilePicker" )
 oFileDialog.execute()
End Sub


Does that answer your question?
_________________
- Knowledge is Power -
Back to top
View user's profile Send private message Send e-mail
DannyB
Moderator
Moderator


Joined: 02 Apr 2003
Posts: 3991
Location: Lawrence, Kansas, USA

PostPosted: Tue Apr 20, 2004 8:56 am    Post subject: Reply with quote

The FilePicker service does not save a dialog. It is to prompt the user to select an existing file, and then give you (the programmer) back the pathanme of the file the user picked.

You might use FilePicker on a macro dialog box that had a "Browse...." button that the user picks to bring up a FilePicker to select the pathname of a file.


Code:
Sub Main
   oDoc = ThisComponent
   oDocCtrl = oDoc.getCurrentController()
   oDocFrame = oDocCtrl.getFrame()
   
   oDispatchHelper = createUnoService( "com.sun.star.frame.DispatchHelper" )
   oDispatchHelper.executeDispatch( oDocFrame, ".uno:SaveAs", "", 0, Array() )
End Sub

_________________
Want to make OOo Drawings like the colored flower design to the left?
Back to top
View user's profile Send private message
Cybb20
Super User
Super User


Joined: 02 Mar 2004
Posts: 1569
Location: Frankfurt, Germany

PostPosted: Tue Apr 20, 2004 10:11 am    Post subject: Reply with quote

Arrow use Danny's code !
_________________
- Knowledge is Power -
Back to top
View user's profile Send private message Send e-mail
Miki
Guest





PostPosted: Tue Apr 20, 2004 11:04 pm    Post subject: Re: Macro for save as dialog box Reply with quote

Thank you DannyB!
Back to top
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group