http://rocketxiao87.blog.163.com/blog/static/6913176520110510032529/
导入Excel库文件
#import "C:\\Program Files\\Microsoft Office\\Office12\\EXCEL.EXE" \
exclude("IFont","IPicture") \
rename("RGB","ExcelRGB") rename("ReplaceText", "ExcelReplaceText") \
rename("CopyFile", "ExcelCopyFile") rename("DialogBox","ExcelDialogBox") \
raw_native_types, auto_search auto_rename
using namespace Excel;
新建Excel对象
Excel::_ApplicationPtr app = NULL;
Excel::Workbooks *books = NULL;
Excel::_WorkbookPtr workbook = NULL;
Excel::SheetsPtr sheets = NULL;
Excel::_WorksheetPtr sheet = NULL;
Excel::RangePtr RgPtr = NULL;
通过上面的对象访问相应的内容,学会用Excel自带的宏录制功能,这样可以在VC中依葫芦画瓢的完成自己想要的功能。