Solved

Is there a way to add a user defind class to a Form? Is there a way to ZOOM an IE session in a WEB BROWSER control?

Posted on 2011-09-15
7
333 Views
Last Modified: 2012-05-12
I have a desire to show several web pages in a miniture format on a form. I would not be manually interacting with these controls but would be via VBA.  I want to basically see which screen responds with a particular screen. This is to give the user warm fuzzies. I currently have the screen in just normal IE windows, and if the users sees a message, they may need to identify which ie instance has a given screen (I am running 7 instances of IE at one time by using a CLASS) (all these pages are on our INTRANET)

That leads to the OTHER portion of the question, since these IE are being class driven, can I add the cls to a form? I have not found a way to.
I am using MS Access 2007
Thnaks

0
Comment
Question by:Bruj
[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
  • 3
7 Comments
 
LVL 19

Accepted Solution

by:
Arno Koster earned 500 total points
ID: 36548305
you could use this code :
Dim Z As Variant     'Z is the value to hold the zoom level.
WebBrowser1.ExecWB OLECMDID_ZOOM, OLECMDEXECOPT_DONTPROMPTUSER, Null, Z
If Z > 0 Then
    Z = Z - 1
Else
    Z = 0
End If
WebBrowser1.ExecWB OLECMDID_ZOOM, OLECMDEXECOPT_DONTPROMPTUSER, Z, Null

Open in new window


and
Dim Z As Variant     'Z is the value to hold the zoom level.
WebBrowser1.ExecWB OLECMDID_ZOOM, OLECMDEXECOPT_DONTPROMPTUSER, Null, Z
If Z < 4 Then
    Z = Z + 1
Else
    Z = 4
End If
WebBrowser1.ExecWB OLECMDID_ZOOM, OLECMDEXECOPT_DONTPROMPTUSER, Z, Null

Open in new window




0
 
LVL 19

Expert Comment

by:Arno Koster
ID: 36548317
For the other part, it might be best to make a new question describing exactly what you want to do with this class in the userform.
There might be a solution to your problem which takes a completely other route but solves your problem way more efficiently.
In order for us to find such a solution we would like to know exactly what your problem is...

a general remark like
I want to basically see which screen responds with a particular screen
does give me much information.
I would assume that you want to know which IE instance has thrown a particular message, but there are quite a number of other options that fit as well.
0
 
LVL 85
ID: 36548333
<can I add the cls to a form>

By "cls", do you mean a Class Module? If so, then you don't really "add" a class to a form, you call that class from code:

Dim clsIE as clsMyClassModule

Set clsIE = New clsMyClassModule

You can then use your "clsIE" variable to work with that instance of your clsMyClassModule class. If that class raises events, you can "sink" your class into the Form's code module by declaring it at the top of the module, in the General Declarations section, like this:

Dim WithEvents clsIE As clsMyClassModule

You would then see all exposed Events of that clsMyClassModule exposed in your form's Code Module - select the class in the leftside dropdown, and you'll see those events populated in the rightside dropdown (in the VBA editor).
0
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 

Author Comment

by:Bruj
ID: 36551121
To akoster:
I tried your code, but got an error :
Automation error
Trying to revoke a drop target that has not been registered
-2147221248
Then I added
    Do While WebBrowser0.Busy
    DoEvents
    Loop
    
    Do While WebBrowser0.ReadyState <> READYSTATE_COMPLETE
        DoEvents
    Loop

Open in new window

and that took care of the error.
Now, that command only effects the size of the FONTS.
OLECMDID_OPTICAL_ZOOM seems to be the correct command for resizing IE 7 and later (I am using 8), but I again I get the automation error, even after testing for full page load.
Any ideas?


LSMConsulting:
That is a great idea. I was debating it, but I felt it MAY be counter productive, as someone may sovle one issue that was not compatible with the other.  So I wanted to atleast state my end desires.
I will post to a seperate thread.


Thanks!
0
 
LVL 19

Expert Comment

by:Arno Koster
ID: 36559222
Looking at the error message, first thought is that the webbrowser controls have not been registered as being able to receive drag-n-drop operations. EG: it does not respond to (dragging &) dropping something on it. Where as on other forums they seem to link this error message to supplying commands to a webbrowser while it is still loading a page, so the waiting until not busy and being complete is appropriate.

Are the webbrowser controls inserted on design-time, or are they generated during run-time ?



0
 

Author Closing Comment

by:Bruj
ID: 36562015
GOt it! Thanks!
Here is the code blocks:
' To Shrink
  Dim zoomBy As Integer
    Dim y As Variant
    zoomBy = 20
    ' This is the bit of code that does the work

   
    y = WebBrowser1.ExecWB(OLECMDID_OPTICAL_ZOOM, OLECMDEXECOPT_DONTPROMPTUSER, CLng(zoomBy), vbNull)
 

Open in new window


To expand:
     y = WebBrowser1.ExecWB(OLECMDID_OPTICAL_ZOOM, OLECMDEXECOPT_DONTPROMPTUSER, CLng(100), vbNull)

Open in new window

0
 

Author Comment

by:Bruj
ID: 36562101
Here is a working example IEControlPanel-Test.accdb

This one shows 7 websites all on 1 form, and then by pressing a button, you can zoom 100 percent to any of the Internet Explorers and then you can shrink it back down.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

636 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