2017-09-15 102 views
0

我已經使用這個代碼,但是這個代碼工作的一個系統,當我用這個macrobook到其他計算機的錯誤maggasae發現運行時錯誤5無效的過程調用或參數錯誤5無效的過程調用或參數

請人提供soluction 。

在此先感謝

Sub ExportAPDF_and_SaveAsXLSX() 
    Dim wsThisWorkSheet As Worksheet 
    Dim strFileName As String 
    Dim strBasePath As String 

    strBasePath = "C:\Users\bmohan.CHECKMATE\Desktop\Debit Note\" 
    strFileName = Range("aa13") 
    Set wsThisWorkSheet = ActiveSheet wsThisWorkSheet.ExportAsFixedFormat _ 
    Type:=xlTypePDF, _ filename:=strBasePath & strFileName, _ 
     Quality:=xlQualityStandard, _ 
     IncludeDocProperties:=True, _ 
     IgnorePrintAreas:=False, _ 
     OpenAfterPublish:=False 
    MsgBox "Data Exported Successfully""" 
    Range("R11").Value = Range("x11").Value + 1 
End Sub 
+1

請您通過突出顯示,並按下Ctrl + K,不以粗體請 – WhatsThePoint

+0

您好,歡迎StackOverflow的格式化你的代碼。 請花一些時間閱讀幫助頁面,特別是名爲 的部分[「我可以問什麼問題?」](http://stackoverflow.com/help/on-topic)和[「什麼類型的問題我應該避免問?「](http://stackoverflow.com/help/dont-ask)。 更重要的是,請閱讀[堆棧溢出問題清單](http://meta.stackexchange.com/q/156810/204922)。 您可能還想了解[最小,完整和可驗證示例](https://stackoverflow.com/help/mcve)。 – GPhilo

回答

0

是用戶名在其他計算機上的不同?如果是這樣,你將要使用環境變量是這樣的:

strBasePath = "C:\Users\" & Environ$("Username") & "\Desktop\Debit Note\" 
相關問題