Solved

Saving custom data in excel

Posted on 2002-06-17
5
283 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Office 365 Training for Admins - 7 Day Trial

Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies.  Only from Platform Scholar.

Question has a verified solution.

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

This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…

635 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