-
Basic Excel Problem
Hello all,
I am working on a project and want to load excel libraries into C++ so that I can read/write data into cells.
Code:
#include <iostream>
#include <cmath>
// Office XP Objects (2003)
#import "C:\Program Files\Common Files\Microsoft Shared\OFFICE12\mso.dll"\
rename("DocumentProperties", "DocumentPropertiesXL")\
rename("RGB", "RBGXL")
//Microsoft VBA objects
#import "C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6\VBE6EXT.OLB"
//Excel Application objects
#import "C:\Program Files\Microsoft Office\Office\excel.exe" \
rename("DialogBox", "DialogBoxXL")\
rename("RGB", "RBGXL")\
rename("DocumentProperties", "DocumentPropertiesXL")\
rename("ReplaceText", "ReplaceTextXL")\
rename("CopyFile", "CopyFileXL")\
exclude("IFont", "IPicture") no_dual_interfaces
using namespace std;
When I wrote the above code, I am getting an error
Code:
fatal error C1083: Cannot open type library file: 'c:\program files\microsoft office\office\excel.exe': Error loading type library/DLL.
Can someone please tell me what I am missing here inorder to run the code.
Thanks In Advance.
-
I think you can add the header:
#include "Excel9.h"
-
-
Hi,
After struggling a little bit, now I am able to write a program to access excel spreadsheets using MFC in VS2005. I am able to create the wrapper and able to access excel files, write data into it by specifying a cell number manually.
Also I can search for data in a given range by using Range.Find() function.
Code:
#define vOpt COleVariant((long) DISP_E_PARAMNOTFOUND, VT_ERROR)
..
..
Range range;
..
..
if(range.Find(COleVariant("09/28"), vOpt, vOpt, vOpt, vOpt, (long) 1, vOpt, vOpt))
{
...
}
Can someone please tell me how to get the cell number of that specific cell where the data is located.
Also is there any good tutorial or help file where I can refer to for further questions.
Thanks in advance
-
Gary
-
-
Everything is in MSDN
(and Win32 grp http://tinyurl.com/cmhb5g for Win32 COM)
Dozens of samples in C and C++ (official code, from MS...)
Similar Threads
-
By mkmkmk2 in forum VB Classic
Replies: 5
Last Post: 02-17-2009, 05:48 AM
-
By mav8 in forum Database
Replies: 2
Last Post: 09-13-2006, 09:15 PM
-
Replies: 125
Last Post: 10-05-2002, 04:34 PM
-
By George in forum VB Classic
Replies: 0
Last Post: 10-24-2001, 06:54 AM
-
By Dan Barclay in forum .NET
Replies: 90
Last Post: 03-09-2001, 08:04 PM
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|