Skip to main content
GameDev.net gamedev.net
🔒 Locked

Visual Basic (VBA) Macro?

Started by Manip Mar 24, 2004 at 5:59 PM 2 replies 450+ views
Original Post
Manip
Manip
In C++, you can do stuff like this: #define Something(X) ( X++; ) in order to shorten what you have to type each time... I was wondering if, hidden in Visual Basic (6) was the same kind of functionality? It does support some pre-compiling logic
#Const thing = 10

#If thing = 10 Then
    Sub thingie()
    MsgBox "Thing IS = 10!"
    End Sub
#Else
    Sub thingie()
    MsgBox "Thing IS NOT = 10..."
    End Sub
#End If
But I have not been able to find a way to do what C++ does. The above information was not easy to get hold of, so I maintain hope that a method does exist but is very obscure. Note: I would be grateful if nobody post their opinions about VB in relation to C++, C# or any other lang god knows we have enough flame wars without starting another one. Thanks. [edited by - Manip on March 24, 2004 7:01:23 PM]
glassJAw
glassJAw
Not in VB6 and as far as I know, not in VB.NET either. There is no preprocessor.

You''re pretty much stuck writing things out in full.
alexmoura
alexmoura
I don''t think there is (or will be in the foreseeable future).
For that case, you''ll have to write a function that does that instead (yes, with the associated extra slowness, but type checking advantage - unless the optimizer decides to inline it, then you have only advantages)

you will get the equivalent of templates in the next release, though



"I woke up sweating and clutching my pillow. Thankfully the powerful and reassuring visage of Optimus Prime staring back at me from my pillow case served to ease my frayed nerves. Like the giant robotic father I never had he always knows just what to say" - Gabe, Penny-Arcade

Alexandre Moura
Manip
Manip
Next version? There is no next version. I refuse to use VB.Net cause its not Basic... but I'm surprised to learn that there is no macro's.

[edited by - Manip on March 25, 2004 6:56:58 AM]

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.