Solved

User-defined type not defined VB6

Posted on 2004-04-02
3
3,379 Views
Last Modified: 2009-07-29
This is an example from Microsoft.
Put al the code in form, added the components mshtml.dll and shdocvw.dll.
Get the following error while trying to run the code.

User-defined type not defined

Dim Sws As New SHDocVw.ShellWindows
Dim IE As SHDocVw.InternetExplorer

Private Sub Form_Load()
   Dim Doc
   List1.Clear
   List2.Clear

   Text1.Text = Sws.Count

   For Each IE In Sws
      List1.AddItem IE.LocationName

      Set Doc = IE.Document
      If TypeOf Doc Is HTMLDocument Then
         'if this is an HTML page, display the title
         'may or may not be the same as LocationName
         List2.AddItem Doc.Title
      End If
   Next
End Sub
0
Comment
Question by:Renebo
3 Comments
 
LVL 19

Expert Comment

by:Shauli
ID: 10745239
Replace these line:
Dim Sws As New SHDocVw.ShellWindows
Dim IE As SHDocVw.InternetExplorer

With these lines:
Dim Sws As New SHDocVwCtl.ShellWindows
Dim IE As SHDocVwCtl.InternetExplorer

S

0
 
LVL 39

Expert Comment

by:appari
ID: 10745263
on which line are you getting the error?
its running fine on my m/c
0
 
LVL 27

Accepted Solution

by:
Ark earned 250 total points
ID: 10746590
Hi
VB Menu->Project->References-> Check Microsoft Internet Contols and Microsoft HTML Object Library
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now