How to fix 'Element not found' when adding watermark by vb.net (64-bit Windows & 64-bit Office)?

0

I want add a text watermark in word.

I use Microsoft.Office.Interop.Word 15. The same code works for office 2016 32-bit, but for office 365 64-bit, will throw the exception 'Element not found' 0x8002802B when I call ".AddTextEffect". How can I fix this problem?

wordDoc = wordApp.Documents.Open(file.FullName)
wordApp.Visible = True
'Create watermark
With wordDoc
    .Activate()
    .ActiveWindow.ActivePane.View.SeekView = Word.WdSeekView.wdSeekCurrentPageHeader
    .ActiveWindow.ActivePane.Selection.HeaderFooter.Shapes.AddTextEffect(
        Microsoft.Office.Core.MsoPresetTextEffect.msoTextEffect1, 
        watermark, font, 1,
        Microsoft.Office.Core.MsoTriState.msoFalse,
        Microsoft.Office.Core.MsoTriState.msoFalse, 0, 0)
End With
ms-word
office-interop
vb.net-2010
watermark
asked on Stack Overflow Dec 28, 2018 by I-Feng Chiu • edited Jan 2, 2019 by I-Feng Chiu

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0