Solved

Saving custom data in excel

Posted on 2002-06-17
5
279 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Office 2016 Install Options 11 71
Excel Error per WinZip Add-In 9 72
Vlookup nonexact IP address match 32 90
Outlook 2010 not responding when sending email. 4 44
Have you ever had the experience that you had to follow 10 steps over and over again every time when you need to nicely forward an important email to your manager? Fear no more! With the help of the Quick Steps feature in Outlook 2010, your old chor…
No matter the version of Windows you are using, you may have some problems with Windows Search running too slow or possibly not running at all. Before jumping into how you can solve this issue, just know there are many other viable alternative deskt…
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…
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.

809 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