Group:  Microsoft Excel ยป microsoft.public.excel.sdk
Thread: Defined constants for Excel automation

Defined constants for Excel automation
Norman Bullen <norm[ at ]BlackKittenAssociates.com> 11/14/2008 1:17:46 AM
Microsoft Office support document WC0993 supplies a list of defined
constants that can be used in Visual Basic and VBA applications to
automate Excel. The document begins with the notice "This article was
written about products for which Microsoft no longer offers support.
Therefore, this article is offered "as is" and will no longer be
updated."

Presumably this is because it refers to Excel 97. Also Visual
Basic and VBA have been supplanted by Visual Basic .Net.

Is there a newer list for Excel 2003 or 2007? I don't care if it's for
..Net because I'm going to convert whatever I can get into #define
statements to be used with C++.
--
Norm

To reply, change domain to an adult feline.

Re: Defined constants for Excel automation
"Scott McPhillips [MVP]" <org-dot-mvps-at-scottmcp> 11/14/2008 1:37:40 AM
"Norman Bullen" <norm[ at ]BlackKittenAssociates.com> wrote in message
news:-OCdnb15jotJUYHUnZ2dnUVZ_q3inZ2d[ at ]earthlink.com...
[Quoted Text]
> Microsoft Office support document WC0993 supplies a list of defined
> constants that can be used in Visual Basic and VBA applications to
> automate Excel. The document begins with the notice "This article was
> written about products for which Microsoft no longer offers support.
> Therefore, this article is offered "as is" and will no longer be
> updated."
>
> Presumably this is because it refers to Excel 97. Also Visual
> Basic and VBA have been supplanted by Visual Basic .Net.
>
> Is there a newer list for Excel 2003 or 2007? I don't care if it's for
> .Net because I'm going to convert whatever I can get into #define
> statements to be used with C++.


You don't want to do this by hand. All of the COM interfaces and defined
constants can be imported (using #import) to a C++ project. This automates
the production of the .h files. For a Word project I #imported MSO.DLL,
VBE6EXT.OLB, and MSWORD.OLB, all of which were installed by Office 2007.
Then use ATL to make life livable with these things.

--
Scott McPhillips [VC++ MVP]

Re: Defined constants for Excel automation
Norman Bullen <norm[ at ]BlackKittenAssociates.com> 11/15/2008 4:09:37 AM
Scott McPhillips [MVP] wrote:
[Quoted Text]
> "Norman Bullen" <norm[ at ]BlackKittenAssociates.com> wrote in message
> news:-OCdnb15jotJUYHUnZ2dnUVZ_q3inZ2d[ at ]earthlink.com...
>
>> Microsoft Office support document WC0993 supplies a list of defined
>> constants that can be used in Visual Basic and VBA applications to
>> automate Excel. The document begins with the notice "This article was
>> written about products for which Microsoft no longer offers support.
>> Therefore, this article is offered "as is" and will no longer be
>> updated."
>>
>> Presumably this is because it refers to Excel 97. Also Visual
>> Basic and VBA have been supplanted by Visual Basic .Net.
>>
>> Is there a newer list for Excel 2003 or 2007? I don't care if it's for
>> .Net because I'm going to convert whatever I can get into #define
>> statements to be used with C++.
>
>
>
> You don't want to do this by hand. All of the COM interfaces and
> defined constants can be imported (using #import) to a C++ project. This
> automates the production of the .h files. For a Word project I
> #imported MSO.DLL, VBE6EXT.OLB, and MSWORD.OLB, all of which were
> installed by Office 2007. Then use ATL to make life livable with these
> things.
>
Thanks!

I've done the #import and the compiler generated a header file
containing the Excel constants. However, it causes two syntax error when
I include it. It's easy enough to fix but I'm surprised that Microsoft
lets this happen.

The generated header contains a declaration of a function DialogBox()
with no arguments. The Windows header file which are included earlier
contain a #define macro DialogBox which requires four parameters so this
declaration fails because too few arguments for a macro.

--
Norm

To reply, change domain to an adult feline.

Re: Defined constants for Excel automation
"Leo Violette" <leov[ at ]primenet.com> 11/16/2008 1:47:14 AM
Look up the #import statement in regards to namespaces. It allows you to
import a library into a namespace so that it doesn't interfere with the
default namespace.

"Norman Bullen" <norm[ at ]BlackKittenAssociates.com> wrote in message
news:98adnfvwRMkH24PUnZ2dnUVZ_h6dnZ2d[ at ]earthlink.com...
[Quoted Text]
> Scott McPhillips [MVP] wrote:
>> "Norman Bullen" <norm[ at ]BlackKittenAssociates.com> wrote in message
>> news:-OCdnb15jotJUYHUnZ2dnUVZ_q3inZ2d[ at ]earthlink.com...
>>
>>> Microsoft Office support document WC0993 supplies a list of defined
>>> constants that can be used in Visual Basic and VBA applications to
>>> automate Excel. The document begins with the notice "This article was
>>> written about products for which Microsoft no longer offers support.
>>> Therefore, this article is offered "as is" and will no longer be
>>> updated."
>>>
>>> Presumably this is because it refers to Excel 97. Also Visual
>>> Basic and VBA have been supplanted by Visual Basic .Net.
>>>
>>> Is there a newer list for Excel 2003 or 2007? I don't care if it's for
>>> .Net because I'm going to convert whatever I can get into #define
>>> statements to be used with C++.
>>
>>
>>
>> You don't want to do this by hand. All of the COM interfaces and defined
>> constants can be imported (using #import) to a C++ project. This
>> automates the production of the .h files. For a Word project I #imported
>> MSO.DLL, VBE6EXT.OLB, and MSWORD.OLB, all of which were installed by
>> Office 2007. Then use ATL to make life livable with these things.
>>
> Thanks!
>
> I've done the #import and the compiler generated a header file containing
> the Excel constants. However, it causes two syntax error when I include
> it. It's easy enough to fix but I'm surprised that Microsoft lets this
> happen.
>
> The generated header contains a declaration of a function DialogBox() with
> no arguments. The Windows header file which are included earlier contain a
> #define macro DialogBox which requires four parameters so this declaration
> fails because too few arguments for a macro.
>
> --
> Norm
>
> To reply, change domain to an adult feline.
>


Re: Defined constants for Excel automation
"Alex Blekhman" <tkfx.REMOVE[ at ]yahoo.com> 11/16/2008 8:52:31 AM
"Leo Violette" wrote:
[Quoted Text]
> Look up the #import statement in regards to namespaces. It
> allows you to import a library into a namespace so that it
> doesn't interfere with the default namespace.

The problem is that often Windows API names are macros (like
`DialogBox', for instance). Macros don't give a damn about
namespaces and pollute whatever translation unit they are in.
That's why there is the "rename" attribute for "#import"
directive.

Alex


Re: Defined constants for Excel automation
"Leo Violette" <leov[ at ]primenet.com> 11/17/2008 9:35:07 PM
You're right Alex, my bad. Somehow I missed that the discussion about about
macros.

"Alex Blekhman" <tkfx.REMOVE[ at ]yahoo.com> wrote in message
news:e2D1qi8RJHA.5080[ at ]TK2MSFTNGP03.phx.gbl...
[Quoted Text]
> "Leo Violette" wrote:
>> Look up the #import statement in regards to namespaces. It allows you to
>> import a library into a namespace so that it doesn't interfere with the
>> default namespace.
>
> The problem is that often Windows API names are macros (like `DialogBox',
> for instance). Macros don't give a damn about namespaces and pollute
> whatever translation unit they are in. That's why there is the "rename"
> attribute for "#import" directive.
>
> Alex
>


Re: Defined constants for Excel automation
Norman Bullen <norm[ at ]BlackKittenAssociates.com> 11/19/2008 3:09:19 AM
Alex Blekhman wrote:
[Quoted Text]
> "Leo Violette" wrote:
>
>>Look up the #import statement in regards to namespaces. It
>>allows you to import a library into a namespace so that it
>>doesn't interfere with the default namespace.
>
>
> The problem is that often Windows API names are macros (like
> `DialogBox', for instance). Macros don't give a damn about
> namespaces and pollute whatever translation unit they are in.
> That's why there is the "rename" attribute for "#import"
> directive.
>
> Alex
>
>
Thanks Alex. I hadn't realized there was a "rename" option.

--
Norm

To reply, change domain to an adult feline.

Home | Search | Terms | Imprint
Newsgroups Reader