none
How I can know the Pre-defined Enum value In VBA RRS feed

  • Question

  • Now I Do MS Office Word Automation Using C++,I Have got the Warpper class _Application,_Selection ,And other Stuff.

     I Find Trick :I Record A maroc and look the code of it in Word2003.Then I know How I can wirte the similar Code in C++.

       " Selection.TypeText Text:="11111111111"
        Selection.HomeKey Unit:=wdLine, Extend:=wdExtend
        Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
        Selection.Font.Bold = wdToggle

    But I don't know the int Value of the wdAlignParagraphCenter pre-defined variable. (There is no same  pre-defined in my C++ cpp /h file )

    So I cann't know the paramter value being passed to pagrgh.SetAlignment() //wdAlignParagraphCenter

    Help me!


    Jzq


    • Edited by Jiazhiqiang Thursday, June 28, 2012 3:50 AM
    • Moved by Helen Zhao Friday, June 29, 2012 2:47 AM (From:Visual C++ General)
    Thursday, June 28, 2012 3:48 AM

Answers

  • Office automation provides a type library.  All enum definitions are there.  Just extract the enums from the type library using OLE View or a similar tool.

    In all fairness, I would use an #import statement to import the entire type library.


    Jose R. MCP
    Code Samples

    Thursday, June 28, 2012 5:07 AM

All replies

  • Office automation provides a type library.  All enum definitions are there.  Just extract the enums from the type library using OLE View or a similar tool.

    In all fairness, I would use an #import statement to import the entire type library.


    Jose R. MCP
    Code Samples

    Thursday, June 28, 2012 5:07 AM
  • Hi Jiazhiqiang,

    According to your description, I'd like to move this thread to "Word for Developers Forum" for better support.

    Thanks for your understanding and active participation in the MSDN Forum.
    Best regards,


    Helen Zhao [MSFT]
    MSDN Community Support | Feedback to us

    Friday, June 29, 2012 2:47 AM
  • I don't know C++ so can't give you precise code, but the wd.... Enums are part of the Word Object Model, and have the same parent as the Selection you are using, so if you use _Application._Selection, then you should be able to use _Application._wdToggle, or something along those lines.
     
     

    Enjoy,
    Tony
    www.WordArticles.com
    Monday, July 9, 2012 12:34 PM