Click here to Skip to main content
15,441,434 members
Home / Discussions / COM
   

COM

 
QuestionWhat type of permissions are needed to resolve Acccess denied for GetDsOfNames to registry entry HKCR\Typelib Pin
ForNow7-Jan-13 11:41
MemberForNow7-Jan-13 11:41 
AnswerRe: What type of permissions are needed to resolve Acccess denied for GetDsOfNames to registry entry HKCR\Typelib Pin
Richard MacCutchan7-Jan-13 22:20
mveRichard MacCutchan7-Jan-13 22:20 
QuestionCreating .OCX file hangs Pin
ForNow1-Jan-13 17:44
MemberForNow1-Jan-13 17:44 
QuestionGetIDsOfNames returning -1 Pin
ForNow27-Dec-12 12:28
MemberForNow27-Dec-12 12:28 
AnswerRe: GetIDsOfNames returning -1 Pin
Richard MacCutchan27-Dec-12 21:48
mveRichard MacCutchan27-Dec-12 21:48 
QuestionMixing native OLE with MFC interface/wrappers Pin
ForNow26-Dec-12 15:30
MemberForNow26-Dec-12 15:30 
AnswerRe: Mixing native OLE with MFC interface/wrappers Pin
DriveByCoder24-Mar-15 7:41
professionalDriveByCoder24-Mar-15 7:41 
Question_WorkSheet::Paste usage Pin
ForNow19-Dec-12 13:01
MemberForNow19-Dec-12 13:01 
Hi,

I am trying to paste a .txt file onto
an Excel spreadsheet

Off hand it seemed to me the logical
method would be _WorkSheet::Paste

I have done countless google searches
and have yet to come up with C++
exampe of how this method is used

This is the prototype of the method in Excel.h
C++
void Paste(const VARIANT& Destination, const VARIANT& Link);


When I did research on the data type VARIANT the documentation said its a union for many data types

One of them being a LDISPATCH type

The code below is a snipet of the code I have been stuggling with to get the _WorkSheet::Paste method
to work

My logic was to get a LDISPATCH pointer to the range off cells I was trying to paste onto

However I keep on running into exceptions

If anyone could shead some light on this I would be very gratefull

thanks in advance
C++
CI46023App theApp;       // Main CwinThread
_Application app;        // excel application object
_Workbook objBook;       // workbook object 
Workbooks objBooks;      // ditto
Worksheets objSheets;    // worksheet object
_Worksheet objSheet;     // worksheet
LPDISPATCH myrangeptr; 





app.CreateDispatch("Excel.Application");
  objBooks = app.GetWorkbooks();
  objBook = objBooks.Add(VOptional);
  objSheets = objBook.GetWorksheets();
  objSheet = objSheets.GetItem(COleVariant((short)1));
  myrangeptr = objSheet.GetRange(COleVariant(TEXT("A1")),COleVariant(TEXT("M34")));
  objSheet.Paste((VARIANT &)myrangeptr, COleVariant((short)TRUE));

AnswerRe: _WorkSheet::Paste usage Pin
Jochen Arndt19-Dec-12 21:45
professionalJochen Arndt19-Dec-12 21:45 
GeneralRe: _WorkSheet::Paste usage Pin
ForNow20-Dec-12 5:21
MemberForNow20-Dec-12 5:21 
GeneralRe: _WorkSheet::Paste usage Pin
Jochen Arndt20-Dec-12 21:04
professionalJochen Arndt20-Dec-12 21:04 
QuestionMSDN documentation for MFC OLE wrapper method/prperties Pin
ForNow17-Dec-12 13:10
MemberForNow17-Dec-12 13:10 
AnswerRe: MSDN documentation for MFC OLE wrapper method/prperties Pin
Richard MacCutchan17-Dec-12 22:19
mveRichard MacCutchan17-Dec-12 22:19 
GeneralRe: MSDN documentation for MFC OLE wrapper method/prperties Pin
ForNow18-Dec-12 2:28
MemberForNow18-Dec-12 2:28 
GeneralRe: MSDN documentation for MFC OLE wrapper method/prperties Pin
Richard MacCutchan18-Dec-12 2:54
mveRichard MacCutchan18-Dec-12 2:54 
Questionabout screen reader how to read PDF file Pin
BCN-16316-Dec-12 16:01
MemberBCN-16316-Dec-12 16:01 
AnswerRe: about screen reader how to read PDF file Pin
April Fans27-Dec-12 15:20
MemberApril Fans27-Dec-12 15:20 
GeneralRe: about screen reader how to read PDF file Pin
BCN-16327-Dec-12 17:41
MemberBCN-16327-Dec-12 17:41 
GeneralRe: about screen reader how to read PDF file Pin
April Fans27-Dec-12 20:34
MemberApril Fans27-Dec-12 20:34 
GeneralRe: about screen reader how to read PDF file Pin
BCN-16321-Jan-13 14:41
MemberBCN-16321-Jan-13 14:41 
Questionrange setvalue Pin
ForNow13-Dec-12 15:31
MemberForNow13-Dec-12 15:31 
SuggestionRe: range setvalue Pin
Richard MacCutchan13-Dec-12 22:52
mveRichard MacCutchan13-Dec-12 22:52 
GeneralRe: range setvalue Pin
ForNow14-Dec-12 8:00
MemberForNow14-Dec-12 8:00 
GeneralRe: range setvalue Pin
Richard MacCutchan14-Dec-12 21:40
mveRichard MacCutchan14-Dec-12 21:40 
GeneralRe: range setvalue Pin
ForNow15-Dec-12 15:23
MemberForNow15-Dec-12 15:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.