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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help printing HTML files from database 1

Status
Not open for further replies.

Lokoono

Programmer
Jun 13, 2007
34
US
I'm using the following line in my Access form, behind a command button, to open a web page in Internet Explorer (the page is located on a local server).

Code:
dRetVal = Shell("C:\Program Files\Internet Explorer\iexplore.exe " & "\\server\file_to_print.htm", 1)

Opening the file is fine, but telling it to print has been a hassle. I haven't worked with Shell since I last worked with batch files in DOS (that's been a long while and it never dealt with html files).

Here's what I need help with:

1. I'd like to be able to print the page if possible. I tried the " /p " tag after iexplore.exe, but that didn't work (it thought that the /p was part of the page address rather than a print switch.


2. I also may have multiple files that need printing from time to time, so is it possible to only have the print dialog box show up only once (or not at all) for the files?

I don't have a problem just going into Windows Explorer and finding the html files, but I want to make this as easy as possible for others and I figured a database would be the way to go.

I'd appreciate any help attempted/given. I looked throughout tek-tips, msdn, and the web for help and could only find examples for pdf files or Microsoft PowerPoint, but not html files.

Thanks!
 
How about doing something like this?

Hope this helps

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.

 
Sorry, you have to be a member to see some of the posts, here's the jist of it (and I posted a link to save my own typing! [lol])
Code:
Set s = CreateObject("InternetExplorer.application")
      
With s
    .Visible = True
    .Navigate "your/filepath"
    
    ' command for printing the webpage
    Do Until .ReadyState = 4 'READYSTATE_COMPLETE
      DoEvents
    Loop
 
    .ExecWB 6, 2, 2, 0 'OLECMDID_PRINT,OLECMDEXECOPT_DONTPROMPTUSER,PRINT_WAITFORCOMPLETION,0
 
' command for closing the webpage
    .Quit
End With

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.

 
Perfecto HarleyQuinn. Worked like a charm. Thanks!

And thanks big time for looking through Experts-Exchange. I had to trim my budget earlier this year, so I wasn't able to look there (and last I checked, my company isn't one of the 900+ that's a member of it).
 
No problem, glad I could help and thanks for the star [smile]



HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top