Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Snapshot Viewer

Status
Not open for further replies.

arst06d

Programmer
Joined
Nov 29, 2002
Messages
324
I need to automate the printing of an Access snapshot report, using the snapshot viewer.
I can invoke the viewer using:
Code:
<script language="javascript">
    function fnShellExecuteJ()
    {
        var objShell = new ActiveXObject("Shell.Application");
        
        objShell.ShellExecute("C:\\Program Files\\Snapshot Viewer\\SNAPVIEW.EXE","\\\\server\\share$\\folder1\\report.snp", "", "open", "1");
    }
</script>

however, using the print action - nothing happens
Code:
<script language="javascript">
    function fnShellExecuteJ()
    {
        var objShell = new ActiveXObject("Shell.Application");
        
        objShell.ShellExecute("C:\\Program Files\\Snapshot Viewer\\SNAPVIEW.EXE","\\\\server\\share$\\folder1\\report.snp", "", "open", "1");
    }
</script>

Thanks in advance
 
That last code should read:
Code:
[code]
<script language="javascript">
    function fnShellExecuteJ()
    {
        var objShell = new ActiveXObject("Shell.Application");
        
        objShell.ShellExecute("C:\\Program Files\\Snapshot Viewer\\SNAPVIEW.EXE","\\\\server\\share$\\folder1\\report.snp", "", "print", "1");
    }
</script>
[/code/
 
just tried vb and no - doesn't work.
Nothing at all happens, in fact - would possibly have expected an error of some sort if the print action is not supported?
 
sorry Dan, was replying to babyJeffy when you posted. I'll check it out.

Thanks
 
Hi Dan

Not sure whether that flavour of ShellExecute is compatible with windows scripting host. I get "Incorrect number of arguments or invalid property assignment"
 
Maybe there is no 'print' option as suggested above. n explorer, right-clicked on a .snp file and select print - opens the viewer and displays, but nothing prints ....
 
managed it as follows:

Code:
function printReport2(strReport)
{
	var strObj;

	strObj = "<OBJECT id=SnapshotViewer style='LEFT: 0px; TOP: 0px' height='0%' width='0%' classid='CLSID:F0E42D60-368C-11D0-AD81-00A0C90DC8D9' VIEWASTEXT>"
	strObj = strObj + "<PARAM NAME='_ExtentX' VALUE='16933'>"
	strObj = strObj + "<PARAM NAME='_ExtentY' VALUE='12700'>"
	strObj = strObj + "<PARAM NAME='_Version' VALUE='65536'>"
	strObj = strObj + "<PARAM NAME='SnapshotPath' VALUE='[URL unfurl="true"]http://apollo04.shb.co.uk/David/Snapshots/Reports/20060306/Options/ibisandintas.snp'>"[/URL]
	strObj = strObj + "<PARAM NAME='Zoom' VALUE='4'>"
	strObj = strObj + "<PARAM NAME='AllowContextMenu' VALUE='-1'>"
	strObj = strObj + "<PARAM NAME='ShowNavigationButtons' VALUE='-1'></OBJECT>"

	
	var snpDiv = document.getElementById("snapshotDiv");
	snpDiv.innerHTML = strObj;
	var snp = document.getElementById("SnapshotViewer");
	snp.PrintSnapshot(false);
	
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top