Solved

50 Easy points!  Is it possible to print with WebBrowser1.Visible set to False?

Posted on 2004-09-07
6
306 Views
Last Modified: 2013-12-25
Here's my code:

Private Sub Form_Load()
     WebBrowser1.Navigate "www.cnn.com"
End Sub

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    If WebBrowser1.ReadyState = READYSTATE_COMPLETE Then
      WebBrowser1.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, 0, 0
    End If
End Sub

Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)
    Me.Caption = Text
End Sub

Is it possible for this code to work if the WebBrowser1.Visible is set to False?
0
Comment
Question by:shaolinfunk
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 11

Expert Comment

by:coopzz
ID: 12003074
yer should do

I do something similar things in vb.net and vb6 eg: a notification service that prints web pages  to printers in a windows service

actually if anyone knows of an object that can print web pages with specified printer without using this internet controls would be a great find
0
 
LVL 53

Accepted Solution

by:
Dhaest earned 25 total points
ID: 12003512
Did you test it ? Perhaps you need another event. Can you give this a try
Private Sub Form_Load()
     WebBrowser1.Navigate "www.cnn.com"
End Sub

Private Sub WebBrowser1_NavigateComplete2(ByVal pDisp As Object, URL As Variant)
    WebBrowser1.Visible = True
    WebBrowser1.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, 0, 0
    WebBrowser1.Visible = False
End Sub

Private Sub WebBrowser1_StatusTextChange(ByVal Text As String)
    Me.Caption = Text
End Sub
0
 
LVL 11

Expert Comment

by:coopzz
ID: 12003606
try that event it worked perfectly

Private Sub WebBrowser1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
    WebBrowser1.Visible = True
    WebBrowser1.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, Null, Null
    WebBrowser1.Visible = False
End Sub
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:shaolinfunk
ID: 12011866
actually.  what i meant by my question was having it set to false ALL the time.  is it possible to do that and still print?  that way, the user doesn't know that there was a webbrowser control there.
0
 
LVL 11

Assisted Solution

by:coopzz
coopzz earned 25 total points
ID: 12012137
well why don't you just use the other solution you got.

http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/VB_Controls/Q_21108534.html

that should work a hell of a lot better.

if you don't want a user to see the form, do a microsoft hack and place the form in a really obscure spot without putting it in the system tray.
top = -1000
left = -1000
showintaskbar = false

cause it looks like with the control it needs to be visible in vb to print Sorry.
but Like I said the other way I've used and works. try starting from scratch again.


0
 
LVL 1

Author Comment

by:shaolinfunk
ID: 12025678
"cause it looks like with the control it needs to be visible in vb to print Sorry."
that's what i wanted to make sure of.  thanks.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
MsgBox 2 61
How to make an ADE file by code? 11 101
Problem to With line 4 76
Excel Automation VBA 19 104
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question