Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
Am exporting multiple table object to a single word document. But in the output word document i can see all the tables merged together.How can i give space between the tables?. here is my code
Sub export_word
set objWord = CreateObject("Word.Application")
objWord.visible = false
set objDoc=objWord.Documents.add
Const wdOrientLandscape = 0
objDoc.PageSetup.Orientation = wdOrientLandscape
ActiveDocument.GetSheetObject("CH02").CopyTableToClipboard true
objWord.Selection.Paste
ActiveDocument.GetSheetObject("CH04").CopyTableToClipboard true
objWord.Selection.Paste
ActiveDocument.GetSheetObject("CH01").CopyTableToClipboard true
objWord.Selection.Paste
'objDoc.SaveAs "C:\Report"
objWord.quit
end sub
Regrads,
Sivaraj
You can simply insert the following VBScript statement between every table .Paste in your macro:
objWord.Selection.TypeText Chr(12)
Chr(12) is ASCII 12 - which is Form Feed that it equivalent to PageBreak in Word. So each new table will land on a new page which I presume you want.
If not you can simply use Chr(13) & Chr(10) ....
I have used objeselction.typetext chr(11) to get space. Your idea is very useful for me. I can use it.
You are welcome. If this answers your question please mark the question as answered so the topic doesn't stay open.