Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Display text object content in headers(MS Word) using macro

I am using Macro to export the tables(in a word document).

Here is the macro

sub exportTable

on error resume next


set objWord = CreateObject("Word.Application")

objWord.visible = true

path = ActiveDocument.Evaluate("'$(QvWorkPath)\'")

'msgbox(path + "Templates\Trame BS.docx")

set objDoc=objWord.Documents.Open(path + "Templates\Sample.docx",true,false)

for i = 1 to 11

ActiveDocument.GetSheetObject("BC"& i ).CopyTableToClipboard (true)

Set rng = objDoc.Content

rng.Find.execute("<BS" & i & ">")

If rng.Find.Found = True Then

  'msgbox("found")

  rng.select

  objWord.Selection.Paste

end if

next

objDoc.SaveAs path + "Templates\BS_TMP.docx"

'objDoc.Close

set objDoc=nothing

'objWord.quit

set objWord=nothing

end sub

I need to display one text object content in Headers of all pages in Word document.

If anyone has written VB script for Headers, please share it.

Thanks

0 Replies