c++ - Get ID of excel worksheet in focus using OLE -
How can I go about getting a worksheet ID using C ++ and OLE which is currently in focus?
For example, I have the following code:
version excelSheets; Variant excel sheet; ExcelSheets.OleProcedure ("Add"); Excel sheet = excel shells OlepropertyGate ("item", 1);
I would like to add a sheet and then I would like to get that sheet which was just added so that I can add content. The above code works only when the user does not take away the floor from the letter that is still on the left.
Seth
I ended up using OlePropertyGet ("ActiveSheet") have make;
Because when you add a sheet, it becomes ActiveSheet and you can work with it from there. I have given an example example below:
version excelApp; Version Excel Books; Variant excelworkbook; Variant excel sheet; Variant Excel Sheets; Try {mExcelApp = Variant :: GetActiveObject ("Excel.Application"); } Grip (EOLSISERR & amp; E) {MEXSellap = Variant :: Create Object ("Excel Application"); // open excel} hold (...) {throw; } MExcelApp.OlePropertySet ("Screen Updating" is true); Excel Books = MxSelfap.OlPropertyGate ("Workbook"); Excelbookbook = excelbook Alloporty Gat ("item", 1); // A worksheet is added which is the active sheet excel sheets. Oleprryer ("add") becomes; ExcelSheet = excelWorkBook.OlePropertyGet ("ActiveSheet");
Comments
Post a Comment