You can use the following namespace.
using namespace Microsoft::Office::Interop::Excel;
Regards,
Uday Takbhate [MSFT]
--------------------
>From: "bill" <wgrigg@draper.com>
>Newsgroups: microsoft.public.dotnet.framework.interop
[quoted text clipped - 7 lines]
>Content-Type: text/plain; charset="iso-8859-1"
>X-Trace: posting.google.com 1127917713 11541 127.0.0.1 (28 Sep 2005
14:28:33 GMT)
>X-Complaints-To: groups-abuse@google.com
>NNTP-Posting-Date: Wed, 28 Sep 2005 14:28:33 +0000 (UTC)
>User-Agent: G2/0.2
>X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1;
.NET CLR 1.1.4322),gzip(gfe),gzip(gfe)
>Complaints-To: groups-abuse@google.com
>Injection-Info: o13g2000cwo.googlegroups.com; posting-host=192.80.95.242;
> posting-account=7vU72gwAAADXwqi6olnMjCDpkupdCL0H
>Path:
TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!newsfeed00.sul.t-online.de!t-onli
ne.de!border2.nntp.dca.giganews.com!nntp.giganews.com!postnews.google.com!o1
3g2000cwo.googlegroups.com!not-for-mail
>Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.dotnet.framework.interop:9877
>X-Tomcat-NG: microsoft.public.dotnet.framework.interop
[quoted text clipped - 30 lines]
>
>Bill
Bill - 29 Sep 2005 15:31 GMT
Uday,
I have already tried
"using namespace Microsoft::Office::Interop::Excel"
It does not accept "Interop". The only intellisense option shown is
"core()"
Bill
--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Uday Takbhate [MSFT] - 30 Sep 2005 01:40 GMT
It is true that intellisense does not show up the "Interop" option but
indeed you can use it.
Try once again.
Regards,
Uday Takbhate [MSFT]
--------------------
>From: Bill <wgrigg@draper.com>
>References: <ywmLLKJxFHA.628@TK2MSFTNGXA01.phx.gbl>
[quoted text clipped - 26 lines]
>Sent via .NET Newsgroups
>http://www.dotnetnewsgroups.com
Bill - 30 Sep 2005 15:18 GMT
Uday,
I think part of my problem was that I did not have a reference to the MS
Office com object. Anyway after adding that the following did compile:
"using namespace Microsoft::Office::Interop::Excel;"
This created a namespace conflict with the following:
"using namespace System::Windows::Forms;"
The form could not be declared because the "Application" part thought is
was an Excel application. Anyway, I solved that problem and now I do not
know how to delcare the Excel application. The following code:
Microsoft::Office::Interop::Excel::Application* ap;
.....
Microsoft::Office::Interop::Excel::Application::Run(ap);
produces the following error message:
"error C2660: 'Microsoft::Office::Interop::Excel::_Application::Run' :
function does not take 1 arguments"
I cannot of course figure out what the call to run the Excel application
looks like because Intellisense shows nothing and there is no
documentation that I can find.
Help,
Bill
--
Sent via .NET Newsgroups
http://www.dotnetnewsgroups.com
Uday Takbhate [MSFT] - 05 Oct 2005 21:44 GMT
Bill,
Intellisense will not show anything in this case.
I guess you are experiencing the following error in the WinMain() right?
If yes then try something like..
int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPTSTR lpCmdLine,
int nCmdShow)
{
System::Threading::Thread::CurrentThread->ApartmentState =
System::Threading::ApartmentState::STA;
System::Windows::Forms::Application::Run(new Form1());
...............
}
Because in WinMain() the Run() method of Form is expected to be called not
that of Excel::Application.
If you are trying to invoke the Run method on Excel::Application then refer
to the following link for more information of this method.
http://msdn.microsoft.com/library/en-us/vbaac11/html/acmthRun_HV05186408.asp
Run method is used to call a macro defined in the excel workbook from using
excel object model.
There is very little documentation available on automation using C++ or
VC++ as most of the MSDN documents assume automation using visual basic
Regards,
Uday Takbhate [MSFT]
--------------------
>From: Bill <wgrigg@draper.com>
>References: <IpW9geVxFHA.3020@TK2MSFTNGXA01.phx.gbl>
[quoted text clipped - 47 lines]
>Sent via .NET Newsgroups
>http://www.dotnetnewsgroups.com
Uday Takbhate [MSFT] - 06 Oct 2005 16:35 GMT
I guess following articles will be helpful to you.
INFO: Using Visual C++ to Automate Office
http://support.microsoft.com/kb/q238972/
Office Automation Using Visual C++
http://support.microsoft.com/kb/q196776/
FILE: B2CSE.exe Converts Visual Basic Automation Code to Visual C++
http://support.microsoft.com/kb/216388/EN-US/
Automating Microsoft Office 97 and Microsoft Office 2000 (C++)
http://www.msdn.microsoft.com/library/default.asp?url=/library/en-us/dno2kta
/html/offaut.asp
Any further queries? Feel free to ask.
Regards,
Uday Takbhate [MSFT]
--------------------
>X-Tomcat-ID: 634164860
>References: <IpW9geVxFHA.3020@TK2MSFTNGXA01.phx.gbl>
<#QObSncxFHA.1132@TK2MSFTNGP10.phx.gbl>
>MIME-Version: 1.0
>Content-Type: text/plain
[quoted text clipped - 97 lines]
>>Sent via .NET Newsgroups
>>http://www.dotnetnewsgroups.com