Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I want to export my sheet to word.
I have tried the macro
sub ExportWord
set objWord = CreateObject("Word.Application")
objWord.visible = true
set objDoc=objWord.Documents.add
Const wdOrientLandscape = 1
objDoc.PageSetup.Orientation = wdOrientLandscape
ActiveDocument.GetSheetObject("SH01").CopyTableToClipboard true
objWord.Selection.Paste
end sub
but it just opens up the macro screen and a word document and doesn't paste
As far as you want to export more than one object or various selection-states from one object you will need a loop through your objects/selections and also a logic to paste them anywhere and position and size them.
For this you will need some efforts to get it work like you want - whereby with the example above and maybe this one: EXPORTING QLIKVIEW OBJECTS TO MICROSOFT WORD TO PREDETERMINED LOCATION.docx it isn't too difficult to adapt the logic (at the beginning start small with a loop over two/three objects/selections and commenting out the various options and then increase step by step the loop-numbers and the complexity).
- Marcus
You couldn't address a sheet over a sheetobject you need a different statement like:
ActiveDocument.ActiveSheet.CopyBitmapToClipboard
- Marcus
Excellent!
Can you change the quality of the export?
Also would there be a way to export all charts as individual images but into the same word doc?
If you mean with quality of the export a slight degree within the sharpness then AFAIK it couldn't be improved. If you creates reports with the report-editor you will get sharp reports but also some other problems. Maybe tools like NPrinting are more suitable.
Beside them if you want to loop over all sheets then take a look here: Automated PowerPoint Presentation Extraction. It's for powerpoint but the logic could be adapted to word.
- Marcus
Ok so that is a bit too much for me to take on.
what about just exporting just 1 chart to word something like...
sub ExportWord
set objWord = CreateObject("Word.Application")
objWord.visible = true
set objDoc=objWord.Documents.add
Const wdOrientLandscape = 1
objDoc.PageSetup.Orientation = wdOrientLandscape
ActiveDocument.GetSheetObject("CH01").CopyTableToClipboard true
objWord.Selection.Paste
end sub
As far as you want to export more than one object or various selection-states from one object you will need a loop through your objects/selections and also a logic to paste them anywhere and position and size them.
For this you will need some efforts to get it work like you want - whereby with the example above and maybe this one: EXPORTING QLIKVIEW OBJECTS TO MICROSOFT WORD TO PREDETERMINED LOCATION.docx it isn't too difficult to adapt the logic (at the beginning start small with a loop over two/three objects/selections and commenting out the various options and then increase step by step the loop-numbers and the complexity).
- Marcus