![]() |
#1
|
|||
|
|||
![]()
Bonjour à vous.
I try to write equations by means of macro. To insert structures into my equations, I use the OMathFunctions. Add method. My macros work most of the time, except when I use the OmathFunctionText function with the constant wdOMathFunctionText. Macro QuiMarche makes for what I expect from it: Code:
Sub QuiMarche() Dim monEq As OMath, maFonction As OMathFunction, maPlage As Range ActiveDocument.Range.Delete Set monEq = ActiveDocument.OMaths.Add(Selection.Range).OMaths(1) 'on insère le radical Set maPlage = monEq.Range Set maFonction = monEq.Functions.Add(Range:=maPlage, Type:=wdOMathFunctionRad) maFonction.Rad.Deg.Range.Text = "3": maFonction.Rad.e.Range.Text = "8" 'on insère la suite Set maPlage = maFonction.Range maPlage.Collapse direction:=wdCollapseEnd maPlage.Text = " est égal à 2." Set maFonction = monEq.Functions.Add(Range:=maPlage, Type:=wdOMathFunctionNormalText) End Sub Erreur d'exécution '6219' : Impossible d'appliquer la fonction texte à une sélection. Code:
Sub QuiNeMarchePas() Dim monEq As OMath, maFonction As OMathFunction, maPlage As Range ActiveDocument.Range.Delete Set monEq = ActiveDocument.OMaths.Add(Selection.Range).OMaths(1) 'on insère le radical Set maPlage = monEq.Range Set maFonction = monEq.Functions.Add(Range:=maPlage, Type:=wdOMathFunctionRad) maFonction.Rad.Deg.Range.Text = "3": maFonction.Rad.e.Range.Text = "8" 'on insère la suite Set maPlage = maFonction.Range maPlage.Collapse direction:=wdCollapseEnd maPlage.Text = "=2" Set maFonction = monEq.Functions.Add(Range:=maPlage, Type:=wdOMathFunctionText) End Sub I have never managed to use the OmathFunctionText function without that error message. In what circumstances is it possible to use this function, and what is its utility? In French ![]() Je cherche à écrire des équations à l'aide de macros. Pour insérer des structures dans mes équations, j'utilise la méthode OMathFunctions.Add. Mes macros fonctionnent la plupart du temps, sauf quand j'utilise la fonction OmathFunctionText avec la constante wdOMathFunctionText. La macro QuiMarche fait ce que j'en attends : … Si je modifie la dernière ligne, la macro émet un message d'erreur que je ne comprends pas : Erreur d'exécution '6219' : Impossible d'appliquer la fonction texte à une sélection. .... Si je neutralise la dernière ligne, la macro fonctionne. Je n'ai jamais réussi à utiliser la fonction OmathFunctionText sans le même message d'erreur. Dans quelles circonstances est il possible d'utiliser cette fonction, et quelle est son utilité ? |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Variables in Equation using OMath object | pooley343 | Word VBA | 0 | 01-09-2015 10:26 AM |
![]() |
meppley7 | PowerPoint | 2 | 04-28-2014 01:44 PM |
tool tip for object | slain | Outlook | 0 | 05-19-2011 06:06 AM |
Problem: object library invalid or contains references to object definitions | aligahk06 | Office | 0 | 08-19-2010 12:29 PM |
Could not load this object as this object is not present in your computer | k.gaurav | Office | 0 | 08-17-2009 09:57 PM |