我正在尝试为名为Export的应用中的按钮编写脚本。主要思想是该按钮将截取当前活动工作表的屏幕截图,并将其附加到Outlook中的电子邮件中。这是它应该做的:
但是,我的脚本只适用于我的本地计算机。一旦我将它部署到Qlikview服务器上,它将无法工作。我怀疑是因为我把它保存到我的本地C盘。一旦我在服务器上部署它,我该如何使它工作?
这是我的代码:
sub sendMail()
Set appOutlook = CreateObject("outlook.application")
'create a new message
Set Message = appOutlook.CreateItem(olMailItem)
With Message
.Subject = "Testing Daily Report"
.HTMLBody = "<span LANG=EN>" _
& "<p class=style2><span LANG=EN><font FACE=Calibri SIZE=3>" _
& "Hello,<br ><br >The weekly dashboard is now available. " _
& "<br>The main overview is attached below:<BR>"
'first we create the image as a JPG file
ActiveDocument.ActiveSheet.ExportBitmapToFile "C:\Snapshot.PNG"
'we attached the embedded image with a Position at 0 (makes the attachment hidden)
TempFilePath = "C:\"
.Attachments.Add TempFilePath & "Snapshot.PNG", olByValue, 0
'Then we add an html <img src=''> link to this image
'Note than you can customize width and height - not mandatory
.HTMLBody = .HTMLBody & "<br>" & "<img src='cid:Snapshot.PNG'" & "width='1200' height='600'><br>"
.To = " "
.Display
End With
end sub