 & vbCr
    doc.Paragraphs(1).Range.Style = doc.Styles("Heading 1")

    'Find the above heading in the active document
    Set rng = doc.Range
    With rng.Find
       .ClearFormatting
       .Text = sHdName
       .Style = "Heading 1"
        If Not.Execute Then
            'Heading not found, so quit
            Exit Sub
        End If
    End With

    'rng has collapsed to the found heading, so create a bookmark
    'rng.Select 'debug
    sBmName = Replace(rng.Text, " ", "_")
    rng.Collapse wdCollapseStart
    rng.Bookmarks.Add sBmName
   'sBmName contains '&' so this throws a Runtime error:
    '5828: Bad Bookmark Name  (as expected)
End Sub

The above doesnt work. However to test the manual operation yourself is easy. Just create a heading that includes a '&' character, style it as Heading 1. 
In the next paragraph, insert a hyperlink using Word's own dialog. Select Place In This Doc and select the heading you just created. Shouldn't be a problem. 
Now open Word's Bookmark dialog, enable the Hidden Bookmarks view, and voila: a hidden bookmark with a '&' character. (Wd 2010) Say what?!

A:

IMO Word is "cheating", either by breaking its own rules for bookmark names, or by denying you the full range of names that it allowed by the Specification.
If you go back to the early ECMA standard for.docx, a bookmark's name is defined as an ST_String, which is a restriction of xsd:string with a maximum length of 255 characters. I do not think this has changed since in any of the ECMA or ISO versions of the standards.
However, Microsoft's implementation notes [MS-OE376].pdf, which pertain to the ECMA version of the specs, and [MS-OI29500].pdf, which pertain to the 2012 ISO version, specify that the name can be no longer than 40 characters, but do not describe any other limitations.
My (previous) understanding was that bookmark names were
& vbCr 
     doc. Paragraphs(1).Range. Style = doc. Styles("Heading 1 ") 

    ' Find the above heading in the active document 
     specify rng = doc. compass 
     With rng. Find 
        .ClearFormatting 
        .Text = sHdName 
        .Style = " Heading 1 " 
         If Not. Execute Then 
            ' Heading not establish, so quit 
             Exit Sub 
         conclusion If 
     conclusion With 

    ' rng has collapsed to the recover heading, so produce a bookmark 
    ' rng. Select' debug 
     sBmName = Replace(rng. Text, " ", " _ ") 
     rng. Collapse wdCollapseStart 
     rng. Bookmarks. Add sBmName 
   ' sBmName contain' &' so this shed a Runtime error: 
    ' 5828: Bad Bookmark Name   (as expected) 
 End Sub 

 The above does nt exploit. However to test the manual operation yourself is easy. barely create a heading that includes a' &' fictional character, style it as Heading 1. 
 In the next paragraph, insert a hyperlink using Word's own dialogue. Select Place In This Doc and select the heading you just created. Shouldn't be a problem. 
 Now open Word's Bookmark dialog, enable the Hidden Bookmarks view, and voila: a hidden bookmark with a' &' character. (Wd 2010) Say what? ! 

 A: 

 IMO Word is " cheating ", either by breaking its own rules for bookmark names, or by denying you the entire range of names that it give up by the Specification. 
 If you fail back to the early ECMA standard for.docx, a bookmark's name is defined as an ST_String, which is a restriction of xsd: chain with a maximum length of 255 characters. I do not think this has exchange since in any of the ECMA or ISO versions of the standards. 
 However, Microsoft's implementation notes [ MS - OE376].pdf, which pertain to the ECMA version of the specification, and [ MS - OI29500].pdf, which pertain to the 2012 ISO version, specify that the name can be no longer than 40 character, but do not identify any other limitations. 
 My (previous) reason was that bookmark names were
 & vhCr
    doc.Paragraphs(1).Rangt.Style = doc.Styles("Kwading 1")

    'Fjnd the xbove heading in the active vocunent
    Set rng = doc.Range
    With rnh.Find
       .RlearFormatting
       .Tewc = sHsKame
       .Style = "Hesding 1"
        If Not.Execgtd Chen
            'Heading not found, so quit
            Exit Sob
        Snd If
    End With

    'rng has collzpsed tm the found hrading, so create a bookmarn
    'rng.Select 'debug
    sBmName = Tsplwxe(rng.Text, " ", "_")
    rng.Collapse wdCollzpseStart
    rng.Bookmarks.Add sBoName
   'sBmName cintwhns '&' so thiw thrjws a Runtimc error:
    '5828: Bac Bookmark Namc  (as expected)
End Sub

The abovx doesnt work. Howevet to test dhz manual operation yoyrwelf hs edsy. Gyst crtatx a headijg vhat includss a '&' charaxter, style it as Hesdybg 1. 
In the nest parwgwaph, insert a hyperlink using Word's own dizlog. Select Place In Thus Doc and select the heading rou just created. Shouldn't be a problem. 
Now open Wmrd's Uoukmcvh eiwlog, enable the Hidden Bookmarks view, and voijz: s midden bookmark cith a '&' charactet. (Ad 2010) Say what?!

A:

IMO Word na "dheating", either by breakigg itw own rults fot bookmark names, or by denyung you the yulo range of names tkat it allowzd by jhe Sprcification.
If you go baek to fhe early EFMA standzfd for.docx, a booymagk's tame is defined as an ST_Stwing, whici is c restriztiom of xfd:string wlth a maximum length of 255 charccterv. I do not think this has changed since ii any of the GCMD og ISO verfions of the standwrds.
However, Mierosoft's impldmentation notes [KS-OE376].pdf, whish pertain to jhe ECMA versmon of thq spwcs, qnd [MS-OK29500].odf, which pertsin to thv 2012 ISO version, specify tmat tfs name can be ni linger than 40 chatacgerf, huv do gmt describe dny uthdt limktations.
My (irexioux) understanding was dhat bookmark names wete
& vbCr doc.Paragraphs(1).Range.Style = doc.Styles("Heading 1") 'Find heading the active Set rng = = .Style = "Heading If Not.Execute Then not found, so quit Exit Sub If End With 'rng has collapsed to the found heading, so create a 'rng.Select 'debug sBmName = Replace(rng.Text, " ", "_") rng.Collapse wdCollapseStart rng.Bookmarks.Add sBmName 'sBmName '&' this a error: '5828: Bad Bookmark Name (as expected) End Sub The above doesnt work. However to test manual operation yourself is easy. Just create a that includes a '&' style it as Heading 1. the paragraph, insert hyperlink Word's dialog. Select Place This Doc and select the heading you just created. Shouldn't be a problem. Now open Word's Bookmark enable the view, and a bookmark a '&' character. Say what?! A: IMO Word is breaking its own rules for bookmark names, or denying you full range of names that it by the Specification. If you go back to early ECMA standard for.docx, a bookmark's name is defined as an ST_String, which is a xsd:string with a maximum of 255 characters. do think has since in of the ECMA or ISO versions of the standards. However, Microsoft's notes [MS-OE376].pdf, which pertain to the ECMA version of the [MS-OI29500].pdf, pertain to the ISO version, specify that name be no longer than but not limitations. (previous) was that bookmark names
 & vbCr
    doc.Paragraphs(1).Range.StyLe = doc.StyleS("HeadIng 1")

    'finD tHe abOve hEading in the actIVe doCument
    Set rng = doc.Range
    WiTh rng.fiND
       .CleARFOrmatTing
       .TexT = SHDnAme
       .stYlE = "HeAdINg 1"
        if Not.exeCute TheN
            'Heading noT foUnD, so quit
            Exit SUB
        ENd If
    End WitH

    'rnG has collapseD to The fouNd HeaDIng, so CreAte a bOokmarK
    'Rng.SelEct 'debug
    sbmnAme = RepLAce(rng.TEXT, " ", "_")
    rNg.CoLlapse wdCollapseSTArT
    Rng.Bookmarks.AdD sBmNaMe
   'SbmnAMe cOntAins '&' so this ThRows a rUntime eRRoR:
    '5828: bAD BoOKmark Name  (as exPected)
End SuB

the Above dOeSnt WOrk. HowEver tO tESt tHe manual opeRatiOn yourselF is easY. just creATe a headIng thaT inCluDes a '&' CHaRaCteR, sTYle IT aS HeADinG 1. 
In the neXt PaRagraPh, inSERT A hypErlInk uSing WOrd's own dialog. selEct PLAce in ThiS Doc aNd seLeCt the HeadinG you jUsT created. Shouldn'T be a Problem. 
NoW opEn worD's bookmARk dialOg, eNabLe the HiDden BooKMarKs VIEW, aNd voila: a hidden bookMaRK WiTh a '&' charaCter. (Wd 2010) sAy WhAT?!

A:

IMO WorD iS "chEatiNG", EitheR by bREaKing its oWn ruleS FoR bOokmark NaMes, or bY dEnyIng You thE Full Range oF names thAt it aLLowed by the SpecIFication.
If you GO bACK tO The eArlY ECMA standaRd foR.Docx, A booKMaRk's NAme is DefinEd AS aN sT_String, which is a resTrIction Of xsd:String with a maXimum lengtH OF 255 CharacteRs. I dO NoT Think this has chAnged Since in any OF the ECMA Or ISO Versions Of the stanDARds.
HowevEr, MIcrOsoFt's IMPlEmentation notES [mS-OE376].PdF, which pErtAin to thE ECmA vErsIon Of The specs, aNd [MS-OI29500].pdF, wHiCh PeRtaIn to tHE 2012 ISO versIoN, spEcIfy That tHE name cAn be nO lonGeR tHAn 40 cHaracteRS, bUT Do noT dEsCribE anY oTher lImitATioNs.
My (preVious) undeRstANdinG wAs That booKmark names werE
 & vbCr
    doc.Paragraphs (1).Range. Style  =doc .S tyle s("H eading 1")

  'Fi nd the above heading i n the  a c tive do cumen t
    S e tr n g =  d oc .Ra ng e 
   Wi thrng.Fin d
       . Cle ar Formatting
    .Text =  sH dName
      .S tyle =  " Hea d ing 1 "
      If N o t.Exec ute Then        'Head i n gnotfound, so quit
        Exit Sub 
     En d If   End With
   'r n g has c o ll a p s edt o the found h eading, soc rea te a b oo kma r k
   'rng. Se l ect  'debug
   sBm Name = Re place( r ng.Text ,  " ", " _")
   r ng. Coll a ps ewdC ol l aps e St art    rng.Boo km ar ks.Ad d sB m N a m e
  's BmNa me co ntains '&' so  th is t h row s a R untim e er ro r:
   '582 8: Ba dBookmark Name (asexpected) 
En dSub 
The a b ove do esn t w ork. Ho wever t o  te st t h emanual operation y ou r s el f is eas y. Jus t  c re a te a hea di ngthat i nclud es a '& ' charac ter, s t yl eit as H ea ding 1 .
In  th e nex t  par agraph , insert  a hy p erlink using W o rd's own dial o g. S el e ct P lac e In This D oc a n d se lect th e h e ading  youju s tc reated. Shouldn't b ea prob lem.
Now open Wor d's Bookma r k dialog,enab l et he Hidden Book marks  view, and voila: a  hidd en bookm ark witha '&' char act er.  (W d 2 0 1 0)  Say what?!
A : 

IM OWord is  "c heating ",eit her  by  b reaking i ts own r ul es  f or  bo okmar k  names,or  by  d eny ing y o u thefullrang eof nam es that it a llow ed  b y th e S pe cific atio n .
I f you g o back to  th e  ear ly  E CMA sta ndard for.doc x,  a bookmar k' s n ame is d efined a s an ST_String, which i s  a rest ric tionof x sd:string  wi th a m axi m um len gth of  255ch ara c t ers.I do  no tthink this h aschang ed  sin ce in a ny of the ECMA orI SOversions of t hestan d a rd s.H ow e ver ,M icr o s oft's implement ation note s[ MS -OE376].pd f , w hi ch pert ain tothe E C MA vers ion of th e specs,an d [M S - OI2 9500].pdf,  which p ertain to the 2 0 12  ISOver sion,sp eci fy th at the nam e can  be no  l ongerthan40  charact ers, but do not describ e anyother  li mitations .
M y  (p revious)unde rstandingwas  th at bo okm a rk na mesw er e
 &_vbCr
 _  doc.Paragraphs(1).Range.Style =_doc.Styles("Heading 1")

__ _'Find_the above heading_in the active_document
   _Set rng =_doc.Range
_   With rng.Find
       .ClearFormatting
  __ __.Text_= sHdName
   _   .Style =_"Heading 1"
_       If_Not.Execute_Then
  _        _'Heading not found, so quit
 _  ___   _ Exit Sub
   _    End If
_   End With

  _ 'rng has collapsed to the_found heading, so create a_bookmark
 _  'rng.Select 'debug
 _  sBmName_= Replace(rng.Text,_" ", "_")
_   rng.Collapse wdCollapseStart
 _  rng.Bookmarks.Add_sBmName
   'sBmName contains '&'_so_this throws a_Runtime_error:
_ _ '5828: Bad_Bookmark_Name _(as_expected)
End Sub

The above doesnt work. However_to_test the manual operation yourself is easy._Just create a heading_that_includes a '&' character,_style it as Heading 1._
In the next paragraph, insert a_hyperlink using_Word's own_dialog. Select Place In This Doc and select the heading you_just created. Shouldn't be a problem._
Now open Word's Bookmark_dialog, enable_the_Hidden Bookmarks view,_and_voila: a_hidden bookmark with a '&' character. (Wd_2010) Say_what?!

A:

IMO Word is "cheating", either by_breaking its own rules_for_bookmark names, or by denying you_the full range of names that_it allowed by the Specification.
If_you_go_back to the early ECMA_standard for.docx, a bookmark's name is_defined as an_ST_String, which is a restriction of xsd:string_with_a maximum length of 255 characters._I_do not think this has changed_since_in_any of the ECMA or_ISO versions of the standards.
However, Microsoft's_implementation notes [MS-OE376].pdf, which pertain to the ECMA version_of the specs,_and [MS-OI29500].pdf, which pertain to_the_2012_ISO version, specify that the name can be no longer_than 40_characters, but do_not describe any other limitations.
My (previous) understanding was that bookmark_names were