1
votes

I would like to ask something about VBScript:

Is a way to open a *.html file using the firefox browser or the microsoft Internet Explorer and make it be printed using a special printer which is not the default/standard printer?

The background: I want to make a *.pdf file using the FreePDF software.

The data source is a local *.html file (without any images).

Could I use the VBScript/VB command "createobject" to create a VB "Application" object? You know ... you use it to create a new word or excel file ...

I would like to use the following code:

https://srccode.wordpress.com/2011/01/28/vba-pdf-dokumente-mit-free-pdf-xp-erzeugen/

The web site shows a way to send files to the FreePDF software which is a pdf printer.

In a first step you create a postscript file and then send it to the FreePDF printer.

Example: You could create a new *.ps out of excel like this:

Dim ws As Worksheet
Set ws = Application.ActiveSheet

Dim strDocument As String
strDocument = "C:\tmp\hello"    ' Name der Ausgabedatei ohne Extension

Dim strPostScript As String
strPostScript = strFile & ".ps"

ws.PrintOut , , , , "FreePDF XP", True, , strPostScript

Dim strFilePdf As String
strFilePdf = Replace(strFilePs, ".ps", ".pdf")

Dim oWsc As Object
Dim oExec As Object

Set oWsc = CreateObject("WScript.Shell")

Set oExec = oWsc.Exec(FREEPDFEXE & " /q /o " & strFilePdf & " " & strFilePs)

Do While oExec.Status = 0
    Sleep 200
Loop

Kill strFilePs

Debug.Print oExec.Status

I tried to realize this using firefox and the iexplorer but it didn't work.

Has anybody new ideas?

It is possible to use this pdf printer software because I mustn't install others on the customers system. FreePDF is installed on every system we deliver to our customers.

1

1 Answers

0
votes
 OLECMDID_PRINT                  = 6, 
 OLECMDID_PRINTPREVIEW           = 7, 
 OLECMDID_PAGESETUP              = 8, 

ExecWB Method


Executes a command on an OLE object and returns the status of the command execution using the IOleCommandTarget interface.

Syntax

object.ExecWB( _
    cmdID As OLECMDID, _
    cmdexecopt As OLECMDEXECOPT, _
    [pvaIn As Variant,] _
    [pvaOut As Variant])

Parameters

cmdID Long that represents the identifier of the command to execute. For more information on command identifiers, see MSHTML Command Identifiers.

cmdexecopt

OLECMDEXECOPT value that specifies the command options.

pvaIn

Optional. A Variant used for specifying command input arguments.

pvaOut

Optional. A Variant used for specifying command output arguments.

The OLECMDEXECOPT enumeration specifies command execution options. One value from this enumeration is passed in the nCmdExecOpt argument of IOleCommandTarget::Exec.

typedef enum  
{ 
    OLECMDEXECOPT_DODEFAULT        = 0, 
    OLECMDEXECOPT_PROMPTUSER       = 1, 
    OLECMDEXECOPT_DONTPROMPTUSER    = 2, 
    OLECMDEXECOPT_SHOWHELP         = 3 
} OLECMDEXECOPT;