View Single Post
  #15   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Request Guidance on Visual Basic Versions

I don't know why StrPtr, VarPtr & ObjPtr are not documented, but there are
alternative APIs to get same. However these are used extensively by the VB
guys and often cited in MSDN examples albeit with the caveat.

ByVal & ByRef serve different purposes, in this context definitely wouldn't
want to pass a pointer to the pointer. No reason not to use 'As Any', the
pointer is a structure that merely looks like a Long in VB.

I'm not aware of the 'C-Language variable passing' compile option you
mentioned, in a quick look I don't see it.

I am sure you are right that some things are easier, if that's the right
word, in C if not more efficient too (notably xll for Excel UDFs). However
it is often surprising how highly optimized VB6 can perform as well as C
when making full use of memory swaps and the compile options disabled. As
for "easier", that predicates first learning C which for many is not as easy
as learning VBA/6.

Regards,
Peter T


"joel" wrote in message
...

Your code only works because of the StrPtr function which is not
documented in VBA. And it is weird that you have to specify that Strptr
yo need to pass using Byval instead of the default ByRef. I wouldn't
use Any as the variable type of the pointers instead I would use LONG
since a pointer is really a long in VBA.

The Strptr() function basically skips the header that VBA put infront
of a variable which contains the Variable type and number of characters.
If yo uwere using VB6 yo can specify the compiling option and use
C-Language variable passing instead of the Microsoft Standard variable
passing.

Again it is easier and clearer to write this code in C-language than in
VBA.


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread:
http://www.thecodecage.com/forumz/sh...d.php?t=166356

Microsoft Office Help