PDA

View Full Version : Some ideas?



hulin40
2004-10-03, 02:12 PM
following is a course:

Private Sub UserForm_Click()
Print "12000" + 12345
End Sub

i want to have a result of "24345",but nothing happened in my form when it ran .there is no "24345" in the form.what's the matter????

mtuersley
2004-10-03, 02:35 PM
What are you trying to do this in, VB or VBA? If VB, it works fine but if you are using VBA, there is no PRINT method for a UserForm. Add a textbox and send the result to it. Also, its never a good idea to add a string with a numerical value. Convert the string to a double, int, single, etc. then add them together.

hulin40
2004-10-04, 10:48 AM
What are you trying to do this in, VB or VBA? If VB, it works fine but if you are using VBA, there is no PRINT method for a UserForm. Add a textbox and send the result to it. Also, its never a good idea to add a string with a numerical value. Convert the string to a double, int, single, etc. then add them together.
what are the differences between VB and VBA??

mtuersley
2004-10-06, 04:32 AM
what are the differences between VB and VBA??

Lots of minor things =)

Forms in particular are different. If you think of a VB form as a true object, then a VBA form is just a class in comparison --- stay the replies here, its just a metaphoric oversimplication. VBA forms have no hwnd or hdc, and neither do the controls. You are limited to only the controls in the toolbox on a clean install - no grids, no commondialog control, extra. Rule of thumb - if you have to browse for a control you didn't download, you can't legally use it.

The language itself has numerous "accents" kinda like comparing AutoCAD to LT. I almost strictly write in VB, then access the resulting DLL. About the only time I write in VBA is for my column so I am not the best authority on the differences. Go to your local library and see if they have O'Reilly's VB and VBA In A Nutshell. The book lists specific differences between the two and its what I use when something that should work, doesn't in VBA.