Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
H. H. is offline
external usenet poster
 
Posts: 2
Default Programming Excel with C++ .Net (MFC)

Hi
I have a couple of queries about adding excel functionality to my program.
I want to open excel using a excel template or excel file that I have
already created.
I've tried using CWorkbooks::Open() method, but I new to this and am
struggling with all the VARIANT parameters.
Does anyone know how to do this or able to point me in the right direction?
Secondly, I want to be able to select a cell at run time to place some data.
I have me able to pick a row in column A using:
int Row;
CString CellStr;
..
..
..
CellStr.Format("A%d",row);
oRange = oSheet.get_Range(COleVariant(CellStr),covOptional) ;

Is there a better way to pick just one cell, instead of using the Range
method?
Also, is there an easy way to pick the column at runtime?

Thanks
H.


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 339
Default Programming Excel with C++ .Net (MFC)


"H." wrote in message
...
Hi
I have a couple of queries about adding excel functionality to my program.
I want to open excel using a excel template or excel file that I have
already created.
I've tried using CWorkbooks::Open() method, but I new to this and am
struggling with all the VARIANT parameters.
Does anyone know how to do this or able to point me in the right

direction?
Secondly, I want to be able to select a cell at run time to place some

data.
I have me able to pick a row in column A using:
int Row;
CString CellStr;
.
.
.
CellStr.Format("A%d",row);
oRange = oSheet.get_Range(COleVariant(CellStr),covOptional) ;

Is there a better way to pick just one cell, instead of using the Range
method?
Also, is there an easy way to pick the column at runtime?

Thanks
H.



First of all, you should create a VBA macro that does something similar to
what you want to do from your C++ program. Once you have something that
works, it should be easier to convert to C++, especailly if you use early
binding. Here's a tool that may be useful, it converts VBA code to C++ using
late binding.

http://support.microsoft.com/kb/216388

/Fredrik




  #3   Report Post  
Posted to microsoft.public.excel.programming
h. h. is offline
external usenet poster
 
Posts: 4
Default Programming Excel with C++ .Net (MFC)

Cheers Fredrik.
I tried the translation program and can make no sense of the code it's
producing.
However I did make me think about manually translating VBA to C++, since the
classes are similiar and there is some help for them in VBA.
I have just realise that I can use covOptional for optional variants and
have been able use CWorkbooks::Open() method to open my file.
Thanks for pointing me in the right direction.

Hamish
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 339
Default Programming Excel with C++ .Net (MFC)


"H." wrote in message
...
Cheers Fredrik.
I tried the translation program and can make no sense of the code it's
producing.
However I did make me think about manually translating VBA to C++, since

the
classes are similiar and there is some help for them in VBA.
I have just realise that I can use covOptional for optional variants and
have been able use CWorkbooks::Open() method to open my file.
Thanks for pointing me in the right direction.

Hamish

AWell, with late binding, the code isn't easy to understand. The absoultely
easiest way to auomate Excel, using compiled code, is to use VB6. You simplu
pass Excel.Application to a property and then write code which will be very
similar to VBA. If you use C++, you should #imprt excel.exe (Excel 2003) so
that you can use early binding.

/Fredrik



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Programming Excel with C++ .Net (MFC)

I don't know if this tool could help with this...but if you want check
out www.kdcalc.com...This lets you develop your code in Excel and then
KDCalc will convert the excel spreadsheet into either a java or .Net
implementation for execution not using Excel. May not help with this
but may be useful in the future. There's a free/no registration
download of the tool to test with. I've used it a bit and it's saved me
a lot of time reprogramming.



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Programming Excel with C++ .Net (MFC)

I don't know if this tool could help with this...but if you want check
out www.kdcalc.com...This lets you develop your code in Excel and then
KDCalc will convert the excel spreadsheet into either a java or .Net
implementation for execution not using Excel. May not help with this
but may be useful in the future. There's a free/no registration
download of the tool to test with. I've used it a bit and it's saved me
a lot of time reprogramming.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
ExCel programming Jae[_2_] Charts and Charting in Excel 2 March 6th 07 07:44 PM
Excel Programming [email protected] Excel Worksheet Functions 0 April 14th 06 07:13 AM
Excel/VBA programming Carlos A Excel Discussion (Misc queries) 2 July 24th 05 10:21 PM
Excel programming seang Excel Programming 1 February 18th 04 07:03 AM
Excel Programming Dan Gorman Excel Programming 2 December 8th 03 07:13 PM


All times are GMT +1. The time now is 04:16 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"