Re: Init. Multi-dimensional String Arrays VB vs. VBA
- From: "cushlomokree" <cushlomokree@xxxxxxxxxxxxxxxx>
- Date: Tue, 29 Apr 2008 10:21:54 -0400
Thanks Jonathan
I was afraid that was the answer!
I sure was deluded. I thought VBA was a working subset of VB (without the
ability to create .exe's and .dll's)
When I "program" I usually use unmanaged C++ (not .NET), so all this
confusion over VB is my own fault.
I've seen the petition before and I agree with its intent, but somehow I
think MS is not listening.
Seems absurd that serious developers who have a huge codebase of linked,
binary executables (vs. CLR) would suddenly be deprived of that option for
extending their products.
As a macro language, I thought WordBasic was fine(Yes . I still keep a copy
of Word95 on my machine because it's faster, and it's NOT using wide
characters). It was actually simple enough for nonprogrammers to accomplish
a lot. Now you're telling me that VBA is just "OfficeBasic."
Has anyone documented the syntactical differences btw. VB (6), VB (.Net),
and VBA? Are there "gotcha's" if you choose to bypass VBA and create a
"Word.Application" object in VB (I attempted this, and it seems to work OK.
The main disadvantage in VB when working with the Word object is that
Intellisense does not seem to work.)? You mentioned the integer size
issue...
Thanks again,
Mike
"Jonathan West" <jwest@xxxxxxxx> wrote in message
news:%23ymAL2XqIHA.5416@xxxxxxxxxxxxxxxxxxxxxxx
"cushlomokree" <cushlomokree@xxxxxxxxxxxxxxxx> wrote in message
news:Onq01VXqIHA.3680@xxxxxxxxxxxxxxxxxxxxxxx
Hi,
I'm having a little syntax nightmare.
I am trying to initialize a small 2-dimensional string array in VBA 6.5
(Word 2003).
I'm using syntax that works OK in Visual Studio 2005 VB, but VBA keeps
giving me an error (Compiler error ...expected expression.)
Here's the code:
Dim bookends(,) As String = {{"(", ")"}, {"[", "]"}, _
{"{", "}"}, {"<", ">"}}
Can anyone shed some light on this?
Yes, you are working under the misapprehension that VB.NET is the same
language as VB. The language was substantially changed in the transition
from VB6 to VB.NET. (Take a look at http://classicvb.org/ if you want to
understand more about this.)
Essentially, you have to regard VB.NET and VBA as two completely different
languages. Even their Integers aren't the same!
In VBA, you can't dimension and initialise a string array in a single
statement. You need to separate the dimension and initialisation.
Dim bookends(3, 1) As String
bookends(0, 0) = "("
bookends(0, 1) = ")"
bookends(1, 0) = "["
bookends(1, 1) = "]"
bookends(2, 0) = "{"
bookends(2, 1) = "}"
bookends(3, 0) = "<"
bookends(3, 1) = ">"
--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
.
- Follow-Ups:
- Re: Init. Multi-dimensional String Arrays VB vs. VBA
- From: Jonathan West
- Re: Init. Multi-dimensional String Arrays VB vs. VBA
- References:
- Init. Multi-dimensional String Arrays VB vs. VBA
- From: cushlomokree
- Re: Init. Multi-dimensional String Arrays VB vs. VBA
- From: Jonathan West
- Init. Multi-dimensional String Arrays VB vs. VBA
- Prev by Date: Re: Converting style based numbering to text
- Next by Date: VB email document code
- Previous by thread: Re: Init. Multi-dimensional String Arrays VB vs. VBA
- Next by thread: Re: Init. Multi-dimensional String Arrays VB vs. VBA
- Index(es):
Relevant Pages
|