Help with a macro to print chart or table to word bookmark and resize
Hi,
I have written the below code to print a chart to word bookmark but it is very grainy and I would like to post as high quality as possible.
Then I would like to resize the chart to scale it inline with the original, but I am stuck on how to resize and paste a good image.
I tried .shapes but I could not get it to work, its works with Powerpoint as I have seen scripts but I can't get it to work with bookmarks and word.
To be honest I just need method that I can post a chart or table to a location, a bookmark is not that important.
Also how do you print a table in word from Qlikview, do you still paste a picture or bitmap?
Thanks.
'////////////////////////////////////////////////////////////////////////////////////////////////// '///////// Print to word ///////// '////////////////////////////////////////////////////////////////////////////////////////////////// Sub Print_to_word() ' http://www.robvanderwoude.com ' Standard housekeeping 'set the QV source Dim objDoc, objFile, objFSO, objWord, strFile, strHTML Dim myFile myFile= "\\Ukhibmdata07\#ukhibmdata07\limitmon\MRMaC Internal Control-SOX-OR\AUDIT MSII LIVE ISSUES\QlikView\MSIIs and No Action Plan\Raw Data\wordtest3.docx" Set objFSO = CreateObject( "Scripting.FileSystemObject" ) ' Create a Word object Set objWord = CreateObject( "Word.Application" ) With objWord ' True: make Word visible; False: invisible .Visible = True ' Check if the Word document exists If objFSO.FileExists( myFile ) Then Set objFile = objFSO.GetFile( myFile ) strFile = objFile.Path Else msgbox "FILE OPEN ERROR: The file does not exist" & vbCrLf ' Close Word .Quit Exit Sub End If ' Open the Word document .Documents.Open strFile ' Make the opened file the active document Set objDoc = .ActiveDocument end with set txt1 = ActiveDocument.GetSheetObject("CH01") txt1.CopyBitmapToClipboard() set objloc = objDoc.Bookmarks("BM01").Range.Paste end sub