Hey, I've been researching ways to code in C++ and manipulate excel files (i.e. read and write data). Right now I've written macros in VBA that output a .csv file that is read by my C++ program. It all works, but I'm still wondering if I can just write all my code in C++.

My question is concerning some code that I found that claims to allow manipulation of Excel using C++. The problem with the code (as far as I can tell) is that the program tries to open a .dll file and rename variables in the .dll file. From what I've read, .dll's are binary and can't be edited like a simple text file.

The full code start on page 62 of this pdf: http://www.maths.manchester.ac.uk/~ahazel/EXCEL_C++.pdf

I think the code is flawed in trying to rename variables in the .dll, which it can't do since .dll's are in binary. I don't really know, though. Here's the code that won't compile:

#import \
"C:\Program Files\Common Files\Microsoft Shared\OFFICE11\mso.dll" \
rename("DocumentProperties", "DocumentPropertiesXL") \
rename("RGB", "RBGXL")

Any ideas? Thanks.

I guess I don't really know why I'm getting any errors, then. I'm using Dev-C++, and the compiler is giving me a number of errors (a few are listed below).

I don't really know what to make of them. When I double click them so that I can see where the error is, it opens mso.dll and shows me where the error is. The reason I thought the problem was that the .dll file is in binary and the compiler can't read it is because I'm looking at mso.dll and all I see are squares and other meaningless symbols. I think I read on the msdn site that the import directive creates a primary and secondary header file -- shouldn't this be where the renaming is occurring?

Here are some of the errors that I am receiving from the code I listed in my first post:
7:1 C:\Crane Program\Testing.cpp [Warning] extra tokens at end of #import directive
8 C:\Crane Program\Testing.cpp In file included from C:\Crane Program\Testing.cpp
1 C:\Program Files\Common Files\Microsoft Shared\OFFICE11\mso.dll stray '\144' in program
8 C:\Crane Program\Testing.cpp In file included from C:\Crane Program\Testing.cpp
1:4 C:\Program Files\Common Files\Microsoft Shared\OFFICE11\mso.dll [Warning] null character(s) ignored
1 C:\Program Files\Common Files\Microsoft Shared\OFFICE11\mso.dll stray '\3' in program