Solved

Saving custom data in excel

Posted on 2002-06-17
5
280 Views
Last Modified: 2007-12-19
Hello:

   I need to write custom data in an excel workbook. I think the best option is to save them in the CustomProperties collection. Is this OK?

   I need to use excel from a VC++ 6.0 application.

   These are my questions:

   1- I get a compiler error when trying to access to "Type" property of a "Office::DocumentPropertyPtr" pointer. I'm using the following lines to use Excel automation in StdAfx.h:

#import "MSO9.DLL"
#import "VBE6EXT.OLB"
#import "EXCEL9.OLB" \
          rename("DialogBox","_DialogBox") \
          rename("RGB","_RGB") \
          exclude("IFont","IPicture")

I've solved that compiler error renaming the line

#pragma implementation_key(684)
inline enum MsoDocProperties Office::DocumentProperty::GetType ( long lcid ) {
    enum MsoDocProperties _result;
    HRESULT _hr = get_Type(lcid, &_result);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
    return _result;
}

to

#pragma implementation_key(684)
inline enum Office::MsoDocProperties Office::DocumentProperty::GetType ( long lcid ) {
    enum MsoDocProperties _result;
    HRESULT _hr = get_Type(lcid, &_result);
    if (FAILED(_hr)) _com_issue_errorex(_hr, this, __uuidof(this));
    return _result;
}

in MSO9.tli. How can I avoid this manual renaming operation?


   2- When I acces to the Custom document properties with this code:
Office::DocumentPropertiesPtr pProps= pWorkbook->CustomDocumentProperties;

   I get a null pointer. How can I access to the custom properties of the workbook?

   Thanks in advance,

Jose.
0
Comment
Question by:fjsen
  • 4
5 Comments
 
LVL 44

Accepted Solution

by:
bruintje earned 200 total points
ID: 7083361
Hi fjsen,

Got no VC++ here but these articles can maybe shed some light on your problem

reading the custom properties of office documents
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q186898

and this article will give some idea how to edit them in vb
http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q224351

it uses the dso.dll activex component to do that

and this one shows how to use automation to read/write doc props from VC++
http://support.microsoft.com/default.aspx?scid=kb;EN-US;q238393

HAGD:O)Bruintje
0
 
LVL 44

Expert Comment

by:bruintje
ID: 7090701
Hi Jose,

any luck with the info out those links?, please give some feedback or we can try something else

like installing VC++ here ;)

Brian
0
 

Author Comment

by:fjsen
ID: 7095413
Does anybody know the answer to the second question?

   Thanks in advance,

Jose.
0
 
LVL 44

Expert Comment

by:bruintje
ID: 7249995
better put a link to this in the C++ section

http://www.experts-exchange.com/Programming/Programming_Languages/Cplusplus/

:O)Bruintje
0
 
LVL 44

Expert Comment

by:bruintje
ID: 7262015
Hello fjsen

this question is open for more then 2 months
time to clean up
if not stated otherwise

my recom will be
-PAQ and refund
-this will be finalized by an EE Moderator
-with no further update (11.09.2002)

PLEASE DO NOT ACCEPT THIS COMMENT AS ANSWER

HAGD:O)Bruintje
posted by ToolzEE v1.0
0

Featured Post

Active Directory Webinar

We all know we need to protect and secure our privileges, but where to start? Join Experts Exchange and ManageEngine on Tuesday, April 11, 2017 10:00 AM PDT to learn how to track and secure privileged users in Active Directory.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In case Office 2010 has not been deployed in your environment, this article may be quite useful. In our office, we wanted a way to deploy Microsoft Office Professional Plus 2010 through an automated batch file via logon script. This article is docum…
Using Word 2013, I was experiencing some incredible lag when typing.  Here's what worked for me....
The viewer will learn how to make their project stand out over others by learning how to change colors and shapes, add spaces, change directions, and add bullets to their charts.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question