here are my codes:
Sub Export()
Dim wsA As Worksheet
Dim wsB As Workbook
Dim strPath As String
Dim strName As String
Dim strPathFile As String
Dim OpenFile
Set wbA = ActiveWorkbook
Set wsA = ActiveWorksheet
strPath = CreateObject("WScript.Shell").specialfolders("Desktop")
If strPath = "" Then
strPath = wbA.path
End If
strPath = strPath & "\"
strName = "My Document"
strFile = strName & ".pdf"
strPathFile = strPath & strFile
wsA.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=strPathFile, _
Quality:=xlQualityStandard,_
IncludeDocProperties:=True,_
IgnorePrintAreas:=False,_
OpenAfterPublish:=False
appPath = "C:\Program Files\TrackerSoftware\PDFViewer\PDFXCView.exe"
OpenFile = Shell(appPath&" "& strPathFile, vbNormalFocus)
End Sub
My generated PDF could be opened on xchange viewer if i didn't command it to save in desktop. Now it only opens Xchange Viewer without my document :(