Welcome to NeoOffice developer notes and announcements
NeoOffice
Developer notes and announcements
 
 

This website is an archive and is no longer active
NeoOffice announcements have moved to the NeoOffice News website


Support
· Forums
· NeoOffice Support
· NeoWiki


Announcements
· Twitter @NeoOffice


Downloads
· Download NeoOffice


  
NeoOffice :: View topic - Macro to open a Form
Macro to open a Form
 
   NeoOffice Forum Index -> NeoOffice Releases
View previous topic :: View next topic  
Author Message
Lorinda
Captain Mifune


Joined: Jun 20, 2006
Posts: 2051
Location: Midwest, USA

PostPosted: Mon Sep 24, 2007 5:14 pm    Post subject: Macro to open a Form

In working on creating my birding database and writing a tutorial for it, I decided to add a button on one form to open another form.

I did some checking in the OOo Base forum, and found this thread.

To my knowledge, all I changed was the name of the form, but I can't get the macro to work. I get a "too many paramters" error.

I asked a followup question in the thread, but have not received any replies. I know we don't have much depth with Base here, but I'm hoping that one of our macro gurus can help me out.

here's the code as I have modified it:

Code:
REM Generic macros needed to open any form
function OpenForm( formContainer as variant, oConnection as variant, sFormName as string) as variant
Dim aProp(1) As New com.sun.star.beans.PropertyValue
aProp(0).Name = "ActiveConnection"
aProp(0).Value = oConnection
aProp(1).Name = "OpenMode"
aProp(1).Value = "open"
OpenForm = formContainer.loadComponentFromURL(sFormName,"_blank",0,aProp())
end function

function getFormsTC() as variant
getFormsTC = thisComponent.Parent.getFormDocuments
end function

function getConnectionTC() as variant
getConnectionTC = thisComponent.Drawpage.Forms(0).ActiveConnection
end function


REM Macro to open specific form called 'Locations Data Entry'. One is needed for each form you wish to open from another form.

sub OpenForm_Locations_Data_Entry( oev as variant )
sFormName = "Locations Data Entry"
OpenForm( getFormsTC, getConnectionTC, sFormName )
end sub


Lorinda
Back to top
Lorinda
Captain Mifune


Joined: Jun 20, 2006
Posts: 2051
Location: Midwest, USA

PostPosted: Wed Oct 03, 2007 7:07 pm    Post subject:

I asked in the OOo Macro forum and found my problem: I was testing the macro by choosing Tools>Macros>Run Macros. If I create a button in a form and assign the macro to it, it works perfectly.
Back to top
Display posts from previous:   
   NeoOffice Forum Index -> NeoOffice Releases All times are GMT - 7 Hours
Page 1 of 1

 
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
You cannot attach files in this forum
You cannot download files in this forum

Powered by phpBB © 2001, 2005 phpBB Group

All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest © Planamesa Inc.
NeoOffice is a registered trademark of Planamesa Inc. and may not be used without permission.
PHP-Nuke Copyright © 2005 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.