Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have used below macro to export qvw sheet to ppt. Export working without attachment. Error showing can not find the specified path. Can anyone suggest me is there any wrong in below macro? I am struggling to find the error
sub exportppt
ActiveDocument.ActiveSheet.FitZoomToWindow
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.GetApplication.Refresh
ActiveDocument.ActiveSheet.ApplyZoomToAllSheets
strDate = CDate(Date)
strDay = DatePart("d", strDate)
strMonth = DatePart("m", strDate)
strYear = DatePart("yyyy", strDate)
If strDay < 10 Then
strDay = "0" & strDay
End If
If strMonth < 10 Then
strMonth = "0" & strMonth
End If
GetFormattedDate = strMonth & "-" & strDay & "-" & strYear
Set v = ActiveDocument.Variables ("EmailAddress")
Email=v.GetContent.String
Path = "C:\Store\QV Documents\Automate Export\"
FileName = "DailyExport_" & GetFormattedDate & ".pptx"
Set objPPT = CreateObject("PowerPoint.Application")
objPPT.Visible = True
Set objPresentation = objPPT.Presentations.Add
PPSlideNo = 1
For i = 0 to activedocument.noofsheets -1
Set PPSlide = objPresentation.Slides.Add(PPSlideNo,12)
ActiveDocument.GetApplication.WaitForIdle
ActiveDocument.ActiveSheet.CopyBitmapToClipboard
PPSlide.Shapes.Paste
Set myApp = CreateObject ("Outlook.Application")
Set myMessage = myApp.CreateItem(olMailItem)
myMessage.BodyFormat = 3 'Outlook.OlBodyFormat.olFormatRichText
myMessage.To = "adam.moun@axx.us.com"
myMessage.CC = "nooj.kity@xx.us.com"
myMessage.Body = "Hi, This is automated report from Qlikview"
myMessage.Attachments.Add "C:\Store\QV Documents\Automate Export\" & FileName
myMessage.Subject = "DailyExport " & Date()
myMessage.Send
Set PPSlide = Nothing
Set PPPres = Nothing
Set PPApp = Nothing
activedocument.nexttab
PPSlideNo = PPSlideNo + 1
NEXT
End Sub
Thanks in advance.
May be issue at below line.
myMessage.Attachments.Add "C:\Store\QV Documents\Automate Export\" & FileName
Instead of local path, try to store on the UNC drive path and try to access from that