LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default VB6 to VBA conversion. Form vs. UserForm differences. Object variable types

Hi,

I'm converting some VB6 forms and classes to run in VBA. Having some real
trouble with converting forms in general and the class modules behind the
forms. Below is a highly simplified example of the trouble - basically
a "Type Mismatch" situation.

I've been doing a ton of F8'ing and looking at both the Locals Window and
the Watches window to try to see why there is a mismatch. Also fooled
around with:

varname1 Is varname2 [tests if both point to same object]
IsObject(identifier) [simple true/false]
TypeName(varname) [returns the type name of the variable, "object" if
object.]

In VB you Dim as Form
In VBA you Dim as userForm or "the-actual-name-of-the-form-class"

Before I throw in the towel and just go with a generic "object" type take a
look at this and see if you can point the way out. (example below)

Any additional info on VBA vs. VB (Forms vs. UserForms) would be greatly
appreciated. I'm new to class modules and event processing and its been a
steep learning curve. Any other great references, books, tutorials very
much appreciated.

Yes, after I "down grade" the code from VB6 to VBA (Office 2000) I need to
upgrade it to VB.NET. Fun!

THANKS!!!

Rick


[create a new form with one ListBox1 on it]

Private i As Integer
Private m_listBox1 As ListBox '<=== why doesn't this work?
'Returns run time error 13 type mismatch???
'Private m_listBox1 As Object '<=== yet this does

Private Sub UserForm_Initialize()
i = 0
Set m_listBox1 = Me.ListBox1
End Sub

Private Sub UserForm_Click()
i = i + 1
m_listBox1.AddItem (i)
End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Object Variable Not Set Error on Selection object Jean Excel Worksheet Functions 3 July 24th 06 06:45 PM
Pivot Table - Object variable or with block variable not set? George Nicholson[_2_] Excel Programming 1 April 16th 04 09:12 PM
Range object to Array object conversion Myrna Larson[_2_] Excel Programming 1 August 1st 03 02:27 AM
Range object to Array object conversion Alan Beban[_3_] Excel Programming 0 August 1st 03 01:24 AM
Range object to Array object conversion Tom Ogilvy Excel Programming 0 August 1st 03 12:16 AM


All times are GMT +1. The time now is 05:21 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"