6 messages in org.openoffice.fr.progRe: [prog] appel de macros
FromSent OnAttachments
PhilippeAug 26, 2005 5:55 am 
Bernard MarcellyAug 26, 2005 7:32 am 
PhilippeAug 26, 2005 8:49 am 
Bernard MarcellyAug 26, 2005 9:55 am 
PhilippeAug 26, 2005 11:40 am 
PhilippeAug 26, 2005 11:37 pm 
Actions with this message:
Paste this link in email or IM:
Paste this link in email or IM:
Atom feed for this thread
Paste this URL into your reader:
Subject:Re: [prog] appel de macrosActions...
From:Philippe (plap@nordnet.fr)
Date:Aug 26, 2005 11:37:47 pm
List:org.openoffice.fr.prog

Philippe a écrit :

Bernard Marcelly a écrit

J'ai déjà répondu récemment dans le contexte COM avec Delphi. Il faut utiliser le dispatcher. En Basic cela donne ceci.

Supposons ouvert un document appelé MessageBox.sxw contenant une bibliothèque maBibli, avec dans son Module1 cette macro: Sub afficher(texte as string) MsgBox(texte) End Sub

Ouvrons un deuxième document contenant cette macro: Sub lancerMacroAilleurs dim fenetreDoc as object, dsp as object fenetreDoc = StarDesktop.CurrentFrame dsp = CreateUnoService("com.sun.star.frame.DispatchHelper") rem -- ici une ligne très longue !!! dsp.executeDispatch(fenetreDoc, "macro://MessageBox/maBibli.Module1.afficher(Hello OOo!)", "", 0, Array())

ça marche impec,

par contre si dans le 1er doc ouvert, si on déclare l'argument(s) optional

.afficher()

Lors du test suivant : If IsMissing(arg) then....

la condition ne semble pas vérifiée, puisque arg contient : 'Error' + 1 caractere inconnu ?

avez-vous déja testée ceci, ou est-ce un problème venant de mon script ?