Method 'SnapshotPrint' of object 'ISnapshotViewer' failed.

I have code that is printing a snapshot file. This code works fine on a number of PCs, but on others it does not. On those PCs where it does not work I get the following error:

Method 'SnapshotPrint' of object 'ISnapshotViewer' failed.

or

Method 'SnapshotPrintDirect' of object 'ISnapshotViewer' failed.

I found Microsoft article 224002 which says to add "File://" to the beginnig of the SnapshotPath string. I have done that but it did not correct the problem. Below is my code:

Dim vSnapShot As New SnapshotViewer
vSnapShot.SnapshotPath = "File://" & vPath
If fShowDialog Then
vSnapShot.PrintSnapshot fShowDialog
Else
vSnapShot.PrintSnapshotDirect Application.Printer.DriverName, Application.Printer.DeviceName, Application.Printer.Port
End If

When I look at the properties of the vSnapShot object on the failing PCs, the vSnapShot.CompressedPath property is getting filled with the full path to a temp folder with a .tmp file which is a copy of the snapshot file I am trying to print.




Answer this question

Method 'SnapshotPrint' of object 'ISnapshotViewer' failed.

  • srshaw3

    The Snapshot Viewer OCX has a method "PrintSnapshotDirect", if I use a control instead of using a Createobject statement the method fails with a mysterious error (Not repairable error ), if I use version 9.0 with the Createobject statement all goes fine, if I use version 10.0 or 11.0 I get an error 2502 invalid or missing snapshot file. In the object properties the file path is correct.

    Dim doc as object

    Set doc = CreateObject("snpvw.Snapshot Viewer Control.1")
    doc.SnapshotPath = "C:\MYFILE.SNP"
    doc.PrintSnapshotDirect "Acrobat Distiller", AdobePrinterName, "C:\MYFILE.PS"

    set doc=nothing

    The only solution I found is very rough: I overwrite with version 9.0 the Snapshot Viewer installed by Office 10 and 11.. the problem seems to be the Snapshot Viewer EXE file associated with .SNP extension and not the OCX file but I'm not sure.

    Thank you for suggestions

    Roberto Patuelli


  • Vinko

    Per our support engineer:

    Thanks for using Microsoft ISV Community Forum, according to your problem, I’m wondering whether you have a form with your application and have a SnapshotViewer Control on the form rather than create by New statement. As far as I know, the SnapshotViewer can only be used in an application with User Interface. If you have already had a form with it and still get errors, please kindly send the error code to me by following code:

    ===

    Private Sub CommandButton1_Click()

    On Error Resume Next

    Me.SnapshotViewer1.SnapshotPath = "c:\People.snp"

    Me.SnapshotViewer1.PrintSnapshot True

    MsgBox SnapshotViewer1.Error

    End Sub

    ===

    -brenda (ISV Buddy Team)



  • Willem Rozendaal

    Per the support engineer:

    CAUSE

    -----------------

    When the Snapshot control is embedded in a form in Access, Internet Explorer or another host application it is given a client site reference, which can be used to obtain additional information from the host. That reference is used to perform a cross-domain check. When the control is not directly embedded, and is instantiated through VBA code in Access, it is never given this client site reference. Therefore we are unable to get any information and we cannot check whether the data is being accessed across domain boundaries.

    RESOLUTION

    -----------------

    If you start the code from a form event, you can insert the control on the form and then instantiate the code. You can also set the Visible property of the control to No so it will not show on the form when in Form view.

    Here is a code sample:

    1) Create a new form.

    2) Go to Insert > ActiveX control and add the Snapshot Viewer Control to this form and rename the control to: mySnapPrint

    3) Save this form as: frmPrintSNPFiles

    4) From the form that is usually used to print the Snapshot files, add a new command button.

    5) On the Click event of this button, add the following code:

    Dim strFilePath As String

    Dim objSnap As SnapshotViewerControl.SnapshotViewer

    Dim strForm As String

    strForm = "frmPrintSNPFiles"

    DoCmd.OpenForm strForm, acNormal, , , , acHidden

    Set objSnap = Forms(strForm)!mySnapPrint.Object

    strFilePath = "C:\Contacts.snp"

    objSnap.SnapshotPath = strFilePath

    objSnap.PrintSnapshot False

    DoCmd.Close acForm, strForm, acSaveNo

    6) Save and close this form and test - the Snapshot file should print without issue.

    By citing the control on a form, it correctly loads the "SNP" file before issuing the print command."

    This posting is provided "AS IS" with no warranties, and confers no rights.

    -brenda (ISV Buddy Team)



  • Luis Abreu

    I'm having the same problem that dgmyers reported. After upgrading to Office XP SP 3 from SP 2, our VBA code inside a subroutine in an MS Access module that uses the snapshot viewer functionality no longer works. Prior to upgrading to Office XP SP3, it worked perfectly. Why isn't the snapshot viewer control backwards compatible with what worked with SP 2
  • Method 'SnapshotPrint' of object 'ISnapshotViewer' failed.