Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
felix18807
Contributor III
Contributor III

Exporting Qlikview Objects To Outlook

Please see the code below. I am trying to automate a system to push multiple qlickview objects into outlook. The issue I am encountering is that when you use the default paste the images resolution goes crazy. I believe the solution is to use pastespecial but I can't get the code right in this line :-

myDoc.Range(0,0).PasteSpecial Placement:=wdInLine, DataType:=wdPasteBitmap

Has anyone got any experience of this or can offer any advice?

Many Thanks

Sub SendMail
Set myApp = CreateObject ("Outlook.Application")
Set myMessage = myApp.CreateItem(olMailItem)

myMessage.BodyFormat = 2 'HTMLFormat

myMessage.To = "XXXXXX@XXXXXXXXXX.com"
myMessage.Subject = "Qlikview Automated Email Testing"

myMessage.Attachments.Add("C:\Users\rbeeston\Desktop\XXXXXX.txt")
myMessage.Attachments.Add("C:\Users\rbeeston\Pictures\SNB.jpg")

Set myInspector = myMessage.GetInspector 'this inserts signature to e-mail
Set myDoc = myInspector.WordEditor
Set ol
myInspector.WordEditor.Content.InsertBefore chr(13)
myInspector.WordEditor.Content.InsertBefore chr(13)
ActiveDocument.GetSheetObject("TB02").CopyTableToClipboard TRUE
myDoc.Range(1,1).Paste
myInspector.WordEditor.Content.InsertAfter chr(13)

myInspector.WordEditor.Content.InsertBefore chr(13)
myInspector.WordEditor.Content.InsertBefore chr(13)
ActiveDocument.GetSheetObject("CH02").CopyBitmapToClipboard
myDoc.Range(0,0).PasteSpecial Placement:=wdInLine, DataType:=wdPasteBitmap


myInspector.WordEditor.Content.InsertBefore chr(13)
myInspector.WordEditor.Content.InsertBefore chr(13)
myInspector.WordEditor.Content.InsertBefore "Dear Colleagues, " & chr(13) & chr(13) & "MESSAGEMESSAGEMESSAGEMESSAGEMESSAGEMESSAGEMESSAGEMESSAGEMESSAGEMESSAGEMESSAGEMESSAGE"


myMessage.Display

Set myMessage = Nothing
Set myApp = Nothing
Set myInspector = Nothing
Set myDoc = Nothing


end sub

1 Solution

Accepted Solutions
felix18807
Contributor III
Contributor III
Author

This always happens to me. I find the answer 10 minutes after giving up and asking a forum..

Anyways I changed the line to "myDoc.Range(0,0).PasteSpecial False, False, 0, False, 5 "

and you can find more info here on why it should be like that -

http://msdn.microsoft.com/en-us/library/office/bb241758(v=office.12).aspx

View solution in original post

1 Reply
felix18807
Contributor III
Contributor III
Author

This always happens to me. I find the answer 10 minutes after giving up and asking a forum..

Anyways I changed the line to "myDoc.Range(0,0).PasteSpecial False, False, 0, False, 5 "

and you can find more info here on why it should be like that -

http://msdn.microsoft.com/en-us/library/office/bb241758(v=office.12).aspx