Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello Developers
I have VB script that exports images to word, but i want the chart title to be bold and the chart should be appeared to left of the word document. Please find the script below that exports images to word. Can someone help me with the requirement as i don't know VB script.
Sub ReportPossible2
Set XWord = CreateObject("Word.Application")
XWord.Visible=true
Set DocWord = XWord.Documents.add()
XWord.Selection.InsertBefore "Titulo"&chr(13)
XWord.Selection.Collapse wdCollapseEnd
ActiveDocument.ClearCache
ActiveDocument.GetApplication.WaitForIdle
set image = ActiveDocument.GetSheetObject("CH02")
image.CopyBitmapToClipboard
XWord.Selection.Paste
end sub
Thanks
Anil
Hi,
maybe you can post this question in a forum related to MS Office rather than QlikView?
thanks
regards
Marco
Hi Anil,
Try this,
Sub Test
Set XWord = CreateObject("Word.Application")
XWord.Visible=true
Set DocWord = XWord.Documents.add()
With XWord.Selection
.InsertBefore "Titulo"&chr(13)
.Font.Bold = True
.Font.Color = RGB(243,58,160)
.Font.Size = 15
.Font.Name = "Georgia"
.Collapse wdCollapseEnd
End With
ActiveDocument.ClearCache
ActiveDocument.GetApplication.WaitForIdle
set image = ActiveDocument.GetSheetObject("CH438")
image.CopyBitmapToClipboard
XWord.Selection.Paste
End Sub
Hi Nagraj
Thanks for the reply. I executed the code by changing the object id but i am not getting the image into word its fetching script into word. Please see the result below.
Titulo
Sub Test
Set XWord = CreateObject("Word.Application")
XWord.Visible=true
Set DocWord = XWord.Documents.add()
With XWord.Selection
.InsertBefore "Titulo"&chr(13)
.Font.Bold = True
.Font.Color = RGB(243,58,160)
.Font.Size = 15
.Font.Name = "Georgia"
.Collapse wdCollapseEnd
End With
ActiveDocument.ClearCache
ActiveDocument.GetApplication.WaitForIdle
set image = ActiveDocument.GetSheetObject("CH438")
image.CopyBitmapToClipboard
XWord.Selection.Paste
End Sub
Thanks
Anil
Hi Nagraj
I made the changes to the script and now its exporting the image to word but i tried to get 2 objects into word the title of the second image is showing to the right side on the word document i want that to be at left side. Can you please help me . Please see the script below.
Sub Test
Set XWord = CreateObject("Word.Application")
XWord.Visible=true
Set DocWord = XWord.Documents.add()
With XWord.Selection
.InsertBefore "Titulo"&chr(13)
.Font.Bold = True
.Font.Color = RGB(243,58,160)
.Font.Size = 15
.Font.Name = "Georgia"
.Collapse wdCollapseEnd
End With
ActiveDocument.ClearCache
ActiveDocument.GetApplication.WaitForIdle
set image = ActiveDocument.GetSheetObject("CH824")
image.CopyBitmapToClipboard
XWord.Selection.Paste
XWord.Selection.InsertBefore "My Chart"&chr(13)
XWord.Selection.Collapse wdCollapseEnd
XWord.Selection.InsertBefore chr(13)
XWord.Selection.Collapse wdCollapseEnd
XWord.Selection.InsertBefore chr(13)
XWord.Selection.Collapse wdCollapseEnd
XWord.Selection.InsertBefore chr(13)
XWord.Selection.Collapse wdCollapseEnd
XWord.Selection.InsertBefore chr(13)
XWord.Selection.Collapse wdCollapseEnd
set image = ActiveDocument.GetSheetObject("CH824")
image.CopyBitmapToClipboard
XWord.Selection.Paste
Thanks
Anil