Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21107

[RESOLVED] Run-time error 1004, Application-defined or object-defined error

$
0
0
Code:

'Save the report
    msFileName = "STT_Audit_" & Format(mdtStartDate, "yyyymmdd") & "_" & Format(mdtEndDate, "yyyymmdd") & "." & msFormat
    sFullFileName = msFilePath & "\" & msFileName
   
    Set fso = New FileSystemObject
    If fso.FileExists(sFullFileName) Then fso.DeleteFile (sFullFileName)
   
    If msFormat = "htm" Then
    Call oExcel.ActiveWorkbook.PublishObjects.Add(xlSourceSheet, sFullFileName, "Sheet1", "", xlHtmlStatic, , "").Publish(True)
    oExcel.ActiveWorkbook.Close (False)
        Call oExcel.Quit
        Shell "explorer " & sFullFileName, vbMaximizedFocus
    Else
        oExcel.ActiveWorkbook.SaveAs (sFullFileName)
        oExcel.Visible = True
    End If
   
    Exit Sub


Viewing all articles
Browse latest Browse all 21107

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>