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
331 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
Industry Leaders: 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!

 

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Traditionally, the method to display pictures in Access forms and reports is to first download them from URLs to a folder, record the path in a table and then let the form or report pull the pictures from that folder. But why not let Windows retr…
This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

728 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