Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #3  
Old 10-19-2019, 01:41 AM
jpl jpl is offline VBA and Omath object Windows 7 64bit VBA and Omath object Office 2010 32bit
Advanced Beginner
VBA and Omath object
 
Join Date: Jan 2016
Location: France
Posts: 33
jpl is on a distinguished road
Default

Votre message ne me rajeunit pas !
Mes conclusions sont les suivantes :
Dans une équation, on peut insérer 21 structures, qui correspondent à l'énumération WdOMathFunctionType.
Par défaut, on insère du texte au format math (qui correspond à la constante wdOMathFunctionText).
On n'a donc pas besoin d'utiliser OMath.Functions.Add pour insérer du texte au format math.
La macro suivante montre la différence entre les deux formes de texte dans une équation.
Code:
Sub TexteMathTexteNormal()
   Dim monEq As OMath, maFonction As OMathFunction, maPlage As Range
   ActiveDocument.Range.Delete
   Set monEq = ActiveDocument.OMaths.Add(Selection.Range).OMaths(1)
   
   'on insere du texte au format math : on n'a pas besoin de la méthode Add
   Set maPlage = monEq.Range
   maPlage.Text = "type=wdOMathFunctionText"
   
   'on insere du texte au format normal : on utilise la méthode Add
   maPlage.Collapse (wdCollapseEnd)
   maPlage.Text = "type=wdOMathFunctionNormalText"
   Set maFonction = monEq.Functions.Add(Range:=maPlage, Type:=wdOMathFunctionNormalText)
  End Sub
Si on met un point d'arrêt à la dernière instruction, on voit bien que le texte "type=wdOMathFunctionNormalText" est inséré au format math, avant d'être converti en texte normal.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Variables in Equation using OMath object pooley343 Word VBA 0 01-09-2015 10:26 AM
VBA and Omath object Click an object on a slide, show another object on the same slide. 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

Other Forums: Access Forums

All times are GMT -7. The time now is 07:24 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft