how to set user defined name for excel using C++

S

S Pammar

Hi, I want to set the user defined name for excel using
com addin written in VC++. In VB, the following will help.
But how to set it in C++. I am trying to use comaddin
sample given by microsoft. But it returns error.
Pls help.

VB equivalent:
Application.ActiveWorkbook.Names.Add Name:="abc",
RefersTo:="abcVal"
 
P

Peter Huang [MSFT]

Hi,

Here is a power tool as following.
216388 FILE: B2CSE.exe Converts Visual Basic Automation Code to Visual C++
http://support.microsoft.com/?id=216388

[Please read the readme.txt in the file above first, and note that use
CreateObject to create he Application]
e.g.
You may need to copy and paste the code below which generate the code for
you.
Dim exApp As Object
Set exApp = CreateObject("Excel.Application")
exApp.Visible = True
exApp.Workbooks.Add
exApp.ActiveWorkbook.Names.Add "tempRange", "=Sheet1!$A$1:$A$1"
exApp.Quit
Set exApp = Nothing

Cheers


Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

--------------------
 

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