Questions tagged [vb6]

Visual Basic 6.0 (VB6) was the final COM-based version of the VB programming language and IDE, last updated in 2004. It is the predecessor to the modern VB.NET.

Visual Basic 6.0 () is the third generation event-driven programming language and integrated development environment (IDE) from Microsoft for its COM programming model. It is also considered a relatively easy programming language to learn and use, because of its graphical development features and BASIC heritage.

The final release of the COM-based Visual Basic was version 6 in 1998. It was last updated in 2004 through Service Pack 6.

  • The designated successor language is . For things like writing COM addins for Microsoft Office you would use or .
  • Support for the VB6 IDE ended on April 8th, 2008.
  • The runtime is supported as part of Windows Vista, 7, 8, 8.1 and 10 and Windows Server 2008, 2012 including R2 and 2016.

Resources:

10799 questions
308
votes
10 answers

What does DIM stand for in Visual Basic and BASIC?

What does Dim stand for in Visual Basic?
Nick Katsivelos
  • 5,060
  • 4
  • 20
  • 11
292
votes
11 answers

Does VBA have Dictionary Structure?

Does VBA have dictionary structure? Like key<>value array?
fessGUID
221
votes
9 answers

Difference between Visual Basic 6.0 and VBA

What is the difference between the two. I always thought VBA is somewhat 'crippled' version of VB, but when a friend asked me the other day I had no idea what the actual differences are. Also, when you use, for example, Excel, is that VB or VBA ?
Thomas Geritzma
  • 6,337
  • 6
  • 25
  • 19
112
votes
3 answers

Equivalent VB keyword for 'break'

I just moved over to the Visual Basic team here at work. What is the equivalent keyword to break in Visual Basic, that is, to exit a loop early but not the method?
Tyronomo
  • 2,047
  • 2
  • 15
  • 22
103
votes
7 answers

What is the difference between dim and set in vba

Pardon me as am a newbie in VBA. Sometimes I use Dim r as Range r = Range("A1") Other times I use Set r = Range("A1") What is the difference? And when should I use what?
Ram
  • 2,237
  • 4
  • 23
  • 27
102
votes
13 answers

VBA array sort function?

I'm looking for a decent sort implementation for arrays in VBA. A Quicksort would be preferred. Or any other sort algorithm other than bubble or merge would suffice. Please note that this is to work with MS Project 2003, so should avoid any of the…
Mark Nold
  • 5,638
  • 7
  • 31
  • 33
87
votes
17 answers

How to use \n new line in VB msgbox() ...?

What is the alternative to \n (for new line) in a MsgBox()?
Wasim A.
  • 9,660
  • 22
  • 90
  • 120
87
votes
9 answers

How do I test if optional arguments are supplied or not?

How do I test if optional arguments are supplied or not? -- in VB6 / VBA Function func (Optional ByRef arg As Variant = Nothing) If arg Is Nothing Then <----- run-time error 424 "object required" MsgBox "NOT SENT" End If End…
Robin Rodricks
  • 110,798
  • 141
  • 398
  • 607
80
votes
8 answers

Is there a need to set Objects to Nothing

I always read that it is recommended to set objects to nothing, once I am done with them. But I normally use them only in functions inside forms. Isn't the reference lost and memory released when the function scope is left, regardless of setting…
Ramon
  • 1,021
  • 1
  • 7
  • 10
75
votes
9 answers

Why is it bad practice to call an eventhandler from code?

Say you have a menu item and a button that do the same task. Why is it bad practice to put the code for the task into one control's action event and then make a call to that event from the other control? Delphi allows this as does vb6 but realbasic…
jjb
  • 1,340
  • 1
  • 13
  • 21
75
votes
1 answer

What is the difference between Dim, Global, Public, and Private as Modular Field Access Modifiers?

In VB6/VBA, you can declare module-level variables outside of a specific Sub or Function method. I've used Private and Public before inside modules and understand them like so: Public - visible to all code inside the module and all code outside…
Ben McCormack
  • 32,086
  • 48
  • 148
  • 223
70
votes
10 answers

Stop Visual Basic 6 from changing my casing

Very simple question that is apparently impossible to find a decent answer to: How can I make Visual Basic 6 stop changing my ^@#*ing variable casing!?! I know that the general opinion of a great many VB users is that this "feature" is actually…
Toji
  • 33,927
  • 22
  • 105
  • 115
68
votes
5 answers

Compile a DLL in C/C++, then call it from another program

I want to make a simple, simple DLL which exports one or two functions, then try to call it from another program... Everywhere I've looked so far, is for complicated matters, different ways of linking things together, weird problems that I haven't…
Carson Myers
  • 37,678
  • 39
  • 126
  • 176
65
votes
8 answers

Alternative IDE for VB6 and VBA

I've been spoiled by Visual Studio 2008 and Eclipse and have to do a little maintenance work on a Visual Basic 6.0 (VB6) application. Is there an alternative/ updated IDE for Visual Basic 6.0? A rewrite is not an option. I'm just fixing a couple of…
Omar Kooheji
  • 54,530
  • 68
  • 182
  • 238
62
votes
24 answers

How do I determine if an array is initialized in VB6?

Passing an undimensioned array to the VB6's Ubound function will cause an error, so I want to check if it has been dimensioned yet before attempting to check its upper bound. How do I do this?
raven
  • 18,004
  • 16
  • 81
  • 112
1
2 3
99 100