none
wdUndefined - What is it? RRS feed

  • Question

  • Hello there

     

    I recorded a macro to try to get an idea of coding for something, and it has a lot of variables set to wdUndefined.  Looking it up in the help file wasn't so helpful as the best I could get out of it was what it wasn't.  Here's an example of what I've got.

        With ListGalleries(wdNumberGallery).ListTemplates(1).ListLevels(1)
            .NumberFormat = "%1."
            .TrailingCharacter = wdTrailingTab
            .NumberStyle = wdListNumberStyleUppercaseLetter
            .NumberPosition = InchesToPoints(0.25)
            .Alignment = wdListLevelAlignLeft
            .TextPosition = InchesToPoints(0.5)
            .TabPosition = wdUndefined
            .ResetOnHigher = 0
            .StartAt = 1
            With .Font
                .Bold = wdUndefined
                .Italic = wdUndefined
                .StrikeThrough = wdUndefined
                .Subscript = wdUndefined
                .Superscript = wdUndefined
                .Shadow = wdUndefined
                .Outline = wdUndefined
                .Emboss = wdUndefined
                .Engrave = wdUndefined
                .AllCaps = wdUndefined
                .Hidden = wdUndefined
                .Underline = wdUndefined
                .Color = wdUndefined
                .Size = wdUndefined
                .Animation = wdUndefined
                .DoubleStrikeThrough = wdUndefined
                .Name = ""
            End With
            .LinkedStyle = ""
        End With
    
    

     

    I'm trying to figure out what it should (or could) be as what I'm working with doesn't have an equivalent to "whatever it wants to be". 

     

    Thursday, December 29, 2011 4:02 PM

Answers

  • wdUndefined is used in two ways:

    One is to indicate that a range doesn't have uniform formatting. For example, if you retrieve the Font.Bold status of the current selection, it is True if all text is bold, False if none of the text is bold, and wdUndefined = 999999 if some, but not all of the text is bold.

    The other is as in your recorded macro: to specify that formatting should be left "as is". You might as well omit lines such as

            .Bold = wdUndefined
    

    since they don't do anything.


    Regards, Hans Vogelaar
    • Marked as answer by Dorris Beaird Thursday, December 29, 2011 5:15 PM
    Thursday, December 29, 2011 4:21 PM

All replies

  • wdUndefined is used in two ways:

    One is to indicate that a range doesn't have uniform formatting. For example, if you retrieve the Font.Bold status of the current selection, it is True if all text is bold, False if none of the text is bold, and wdUndefined = 999999 if some, but not all of the text is bold.

    The other is as in your recorded macro: to specify that formatting should be left "as is". You might as well omit lines such as

            .Bold = wdUndefined
    

    since they don't do anything.


    Regards, Hans Vogelaar
    • Marked as answer by Dorris Beaird Thursday, December 29, 2011 5:15 PM
    Thursday, December 29, 2011 4:21 PM
  • Thanks Hans,

    It was looking like the answer would be, essentially, "Leave it the way you find it"

    • Proposed as answer by RakLali Sunday, August 16, 2015 5:11 AM
    • Unproposed as answer by RakLali Sunday, August 16, 2015 5:11 AM
    Thursday, December 29, 2011 5:17 PM
  • To Use the wdUndefined in VB.Net, use following Code:-

    Dim oWord As Word.Application
    Try
      oWord = GetObject("", "Word.Application")
      If oWord Is Nothing Then
         oWord = CreateObject("Word.Application")
      Else
         oWord = GetObject(, "Word.Application")
      End If
    With <expression>.Font
         .Bold = oWord.wdUndefined
    End With

    Sunday, August 16, 2015 5:15 AM
  • There is no point whatsoever in setting the Bold property to wdUndefined.

    Regards, Hans Vogelaar (http://www.eileenslounge.com)

    Sunday, August 16, 2015 9:32 AM