PDA

You are currently viewing a search engine-friendly (archive) version of this page.

View Full Version : Macros and VBscript in VisualStudio 6


Tonker
February 15, 2001, 02:35 pm
Does anybody here know how I can use a dialog box as opposed to a MsgBox for my macros in VC 6?

Much of the code I'm typing is fairly repetitive, and I have a function which writes a command header to a buffer of memory. This is done for every command. I'd like to be able to write in the standard comment for it and the function call itself with a macro. The only snag is that I need to change a command code that I pass to the function. It would be nice if I could throw up a message box prompting me for the command code then use that information to generate the function call.

It seems that VC6 uses VBScript for its macros, and since I don't really know much about VBSscipt or writing macros ( I have some VB experience) I was wondering if someone here might have any suggestions?

------------------

Tonker
February 19, 2001, 04:20 pm
Managed to figure this one out with a bit of help from Google.com.

dim myString
myString = InputBox( "Please enter info:")

myString will now contain whatever the user typed into the dialog box.

Upon consideration, maybe I should have checked in the WebProgramming forum, since it was VBScript.



------------------

MikeFoster
February 20, 2001, 11:23 am
Hi Tonker,

Sorry we didn't respond. I guess I didn't understand exactly what you needed - but I should've asked for more info.

Glad you found the answer!

BTW, welcome to HelpFromTechs.com!

------------------
Mike Foster : moderator : HelpFromTechs.com
Tell us about your favorite HTML editor! (http://www.helpfromtechs.com/ubb/Forum8/HTML/000030.html)

<FONT COLOR="#800080" SIZE="1" FACE="Verdana, Arial">This message has been edited by MikeFoster on February 20, 2001 at 08:25 AM</font>

Dashwood95
September 9, 2001, 10:46 am
Hey Tonker, did that work alright for you because you really are supposed to specify a type when you "dim" a variable. For instance...

Dim MyString as string

MyString = inputBox ("Prompt","Title","Default Text",XPosition, YPosition, Help file, Context)

Although you can fill all those fields in, you are only required to fill in the prompt, which is the line that gives the inputbox a question to ask the user. I know this is months late, but maybe someone else can use it.

------------------
Dashwood95@aol.com-Queen of Typos
I am like my favorite food, lasagna. I have many layers!

Tonker
September 13, 2001, 08:15 pm
Hi Dashwood,

Yep it worked fine for me. I seem to remember when you do:

Dim MyVarName

MyVarName is then declared as a variable of type variant( i think or something like that ). This means that it can accept any type of data. The only problem with that is it will occasionally screw up precise calculations.

------------------

Dashwood95
September 13, 2001, 11:21 pm
You are correct that the default is variant, but we were told never to use that for our programs since there are more precise declarations. I'm glad it worked for you.

------------------
Dashwood95@aol.com-Queen of Typos
I am like my favorite food, lasagna. I have many layers!

Tonker
September 14, 2001, 07:11 pm
Yep you're right. We were told not to use it. It was fine for a first draft, though. I wasn't too sure what the message box would return. I did change it later to:

dim Response as String



------------------