总是提示找不到文件,但是我的路径是对的阿,大人帮我看看阿
谢谢了,偶非常急阿!!!!!!Dim xlApp As Excel.Application
    Set xlApp = New Excel.Application
    
    Set xlApp = CreateObject("Excel.Application")
    xlApp.Visible = False '隐藏EXCEL应用程序窗口
    
    Dim strSource As String
    Dim strDestination1 As String
    strSource = App.Path & "\report\planRenkou.xls"
    'RegisterFee.xls就是一个模版文件
    strDestination1 = App.Path & "\report\temp.xls"
    Set xlBook = xlApp.Workbooks.Open("strDestination")
    '打开工作簿,strDestination为一个EXCEL报表文件
    Set xlSheet = xlBook.Worksheets(1)
    
    
    FileCopy strSource, strDestination
    '将模版文件拷贝到一个临时文件
    
    xlBook.Save  '保存文件
    xlSheet.PrintOut  '执行打印
    xlApp.Quit  '退出EXCEL

解决方案 »

  1.   

    Set xlBook = xlApp.Workbooks.Open("strDestination")改为Set xlBook = xlApp.Workbooks.Open(strDestination)
      

  2.   

    Set xlBook = xlApp.Workbooks.Open("strDestination")
    这句话的变量trDestination编程字符串“trDestination”了
      

  3.   

    感谢楼上两位大人,文件找到了,但是运行到filecopy的时候弹出信息:拒绝的权限
    我看了我的那两个文件,并不是只读的阿,父文件夹也不是
      

  4.   

    直接用
    xlBook.Saveas filename'文件名和路径