how to parse a string using VBA?

K

Karl E. Peterson

Geoff said:
Never had this work with PPT 2003!

Dunno what's up with that, but I have seen installs where you had to start
the VBA help manually. Also, sometimes, jerky admins don't even install the
VBA help.
When I look up Spilt and then Split function with MS Visual Basic
HelpI don't seem to get the version you used - do I?

Version of what?
 
K

Karl E. Peterson

Also, does this work the way it is (I think) intended to work?

Dim iLength, i, count, newStart As Long

The datatypes of iLength, i, count, and newStart are (I think)
supposed to be long. But are they?

No, only the last one is a Long. The others are the default datatype;
presumably Variant.
 
D

David M. Marcovitz

No, only the last one is a Long. The others are the default datatype;
presumably Variant.

OK. I threw together some quick code and didn't check it carefully. Thanks
for the pointers. I'll be more careful next time.
--David
 
K

Karl E. Peterson

David said:
OK. I threw together some quick code and didn't check it carefully.
Thanks for the pointers. I'll be more careful next time.

You "grew up" in C, right? <g>

VB is verbose. Not that that's a *bad* thing.

One last tip... With arrays, the very best habit to get into is to _always_
specify both the top and bottom bounds. IOW, using your previous example,
there's no way to have confused this declaration:

Dim aStrings(0 To 5) As String
or
Dim aStrings(1 To 6) As String

Maybe the best message I can convey is, don't trust defaults in VB. If
there's a way to say-so explicitly, it's absolutely worth the few extra
keystrokes.
 
S

Steve Rindsberg

I have only the 2003 version (with SP 2) and F1 does not work here

Thanks, Geoff. I can stop lashing myself for this. <g>

In the meanwhile, we'll both have to type what we want into the little box at upper
right of IDE. Note that copy/pasting the term you're after doesn't always work
either. Usually yes, but sometimes it pastes something entirely unrelated.

Then again, sometimes this machine's monitor spins round and spews nasty green
stuff. It doesn't like it when I get to close to it with cloves of garlic either.
 
A

Austin Myers

Maybe the best message I can convey is, don't trust defaults in VB. If
there's a way to say-so explicitly, it's absolutely worth the few extra
keystrokes.


What? And take all the fun and surprises out???
 
D

David M. Marcovitz

You "grew up" in C, right? <g>

Actually, a quick perusal of my bookshelf reminds me that my oldest
programming book is Fortran 77. C didn't come until much later.
 
D

David M. Marcovitz

Wait, I just remembered that I have 2003 with SP2 and F1 doesn't work for
me either. I always thought it was a stupid PC thing because it works on
my Mac.
--David

--
David M. Marcovitz
Microsoft PowerPoint MVP
Director of Graduate Programs in Educational Technology
Loyola College in Maryland
Author of _Powerful PowerPoint for Educators_
http://www.PowerfulPowerPoint.com/
 
K

Karl E. Peterson

David said:
Actually, a quick perusal of my bookshelf reminds me that my oldest
programming book is Fortran 77. C didn't come until much later.

Heh, yeah, F77 here too, but that was after whatever dialect of BASIC was
running on those teletypes I started with. <g>
 
S

Steve Rindsberg

David M. said:
Wait, I just remembered that I have 2003 with SP2 and F1 doesn't work for
me either. I always thought it was a stupid PC thing because it works on
my Mac.

Welcome aboard. Misery loves company and at least you can bring classes, if
not class, to the group. ;-)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top