1

I am trying the below code used to print a webpage as pdf

 IE.ExecWB 6, 2, "U:\Translations", Null

I am not sure how to specify the path name in the above syntax . The parameters as as follows :

object.ExecWB nCmdID, nCmdExecOpt, [pvaIn], [pvaOut]
Teamothy
  • 2,000
  • 3
  • 16
  • 26

1 Answers1

2

browser.ExecWB method does not have any parameter to pass the file path.

object.ExecWB nCmdID, nCmdExecOpt, [pvaIn], [pvaOut]

The ExecWB method requires an OLE Command ID to be passed in to identify the command to execute. This value nCmdID is of type Long. The nCmdExecOpt parameter represents the value for the command execution option. Together, these values instruct the control as to what supported command to execute and what degree of user prompting should occur.

The last two parameters pvaIn and paOut are optional and is usually set to either NULL or an empty string.

Here is a complete list for the 1st parameter

OLECMDID_OPEN                   1   Open
OLECMDID_NEW                    2   Create a new document
OLECMDID_SAVE                   3    Preservation
OLECMDID_SAVEAS                 4    Save as
OLECMDID_SAVECOPYAS             5    
OLECMDID_PRINT                  6   Print
OLECMDID_PRINTPREVIEW           7   Print preview
OLECMDID_PAGESETUP              8   Page setup
OLECMDID_SPELL                  9   The spelling check
OLECMDID_PROPERTIES             10  Attribute
OLECMDID_CUT                    11  Shear
OLECMDID_COPY                   12  Replication
OLECMDID_PASTE                  13  Paste
OLECMDID_PASTESPECIAL           14  Paste special
OLECMDID_UNDO                   15  Revoke
OLECMDID_REDO                   16  Repeat
OLECMDID_SELECTALL              17  Select all
OLECMDID_CLEARSELECTION         18  Clear selection
OLECMDID_ZOOM                   19  
OLECMDID_GETZOOMRANGE           20  
OLECMDID_UPDATECOMMANDS         21  The update command
OLECMDID_REFRESH                22  Refresh
OLECMDID_STOP                   23  Stop it
OLECMDID_HIDETOOLBARS           24  Hide toolbar
OLECMDID_SETPROGRESSMAX         25  Progress bar maximum
OLECMDID_SETPROGRESSPOS         26  Progress bar position
OLECMDID_SETPROGRESSTEXT        27  Progress bar text
OLECMDID_SETTITLE               28  Set the title
OLECMDID_SETDOWNLOADSTATE       29  Set download status
OLECMDID_STOPDOWNLOAD           30  Stop downloading
OLECMDID_ONTOOLBARACTIVATED     31  
OLECMDID_FIND                   32  Search
OLECMDID_DELETE                 33  Delete
OLECMDID_HTTPEQUIV              34  
OLECMDID_HTTPEQUIV_DONE         35  
OLECMDID_ENABLE_INTERACTION     36  Allow the interaction
OLECMDID_ONUNLOAD               37  When uninstall
OLECMDID_PROPERTYBAG2           38  
OLECMDID_PREREFRESH             39  
OLECMDID_SHOWSCRIPTERROR        40  
OLECMDID_SHOWMESSAGE            41  Display a message
OLECMDID_SHOWFIND               42  Display search
OLECMDID_SHOWPAGESETUP          43  Display page setup
OLECMDID_SHOWPRINT              44  Display and printing
OLECMDID_CLOSE                  45  Close
OLECMDID_ALLOWUILESSSAVEAS      46  
OLECMDID_DONTDOWNLOADCSS        47  
OLECMDID_UPDATEPAGESTATUS       48  
OLECMDID_PRINT2                 49  Print 2
OLECMDID_PRINTPREVIEW2          50  Print preview
OLECMDID_SETPRINTTEMPLATE       51  Set the print template
OLECMDID_GETPRINTTEMPLATE       52  Get a print template
OLECMDID_PAGEACTIONBLOCKED      55  
OLECMDID_PAGEACTIONUIQUERY      56  
OLECMDID_FOCUSVIEWCONTROLS      57  
OLECMDID_FOCUSVIEWCONTROLSQUERY 58  
OLECMDID_SHOWPAGEACTIONMENU     59  
OLECMDID_ADDTRAVELENTRY         60  
OLECMDID_UPDATETRAVELENTRY      61  
OLECMDID_UPDATEBACKFORWARDSTATE 62  
OLECMDID_OPTICAL_ZOOM           63  
OLECMDID_OPTICAL_GETZOOMRANGE   64  
OLECMDID_WINDOWSTATECHANGED     65  windows status change

Here is a complete list for the 2nd parameter

OLECMDEXECOPT_DODEFAULT         0   Default parameters
OLECMDEXECOPT_PROMPTUSER        1   Prompt the user, namely the pop-up dialog box
LECMDEXECOPT_DONTPROMPTUSER     2   User is not prompted
OLECMDEXECOPT_SHOWHELP          3   displays help

IE.ExecWB method can be used to print the web page as PDF but it will prompt the user to select the folder and ask the file name to save it.

This method does not have any parameter to pass the file path. So if you are looking for using the path written in your code than you need to change your logic and modify your code based on that.

References:

(1) ExecWB method

(2) Microsoft Internet Controls

Deepak-MSFT
  • 10,379
  • 1
  • 12
  • 19