How can I delete a particular break in the document? There is an example of accessing breaks collection through a window pane, but what if my application is running windowless? (What I don't like in vba reference is the ambiguity of objects accessors. Is a window pane the only class able to access breaks collection?)
//MS Word VBA referense
Dim objBreaks As Breaks
Set objBreaks = ActiveDocument.ActiveWindow _
.Panes(1).Pages(1).Breaks
Also, not to create additional question: I'm getting error Type mismatch when trying to InsertBreak via Range using parameters (for instance, wdPageBreak or wdLineBreak). But it's ok, to InsertBreak parameterless. Am I the only one getting such a behaviour, or is it another Word API bug?
//MS Word VBA Reference
Set myRange = ActiveDocument.Paragraphs(2).Range
With myRange
.Collapse Direction:=wdCollapseEnd
.InsertBreak Type:=wdPageBreak
End With
//c++ code
HRESULT hr = pWordDoc->GetParagraphs()->Item(1)->GetRange()->
InsertBreak(&variant_t(Word::wdPageBreak)); //hr = 0x80020005 TypeMismatch
hr = pWordDoc->GetParagraphs()->Item(1)->GetRange()->
InsertBreak(&vtMissing); // hr = S_OK
User contributions licensed under CC BY-SA 3.0