Home > Software engineering >  VC MFC excel operation how to turn a the excel sheet copy to another excel
VC MFC excel operation how to turn a the excel sheet copy to another excel

Time:09-25

For a great god, every time I copy of the original sheet format has changed in the past

CodePudding user response:

@ sars0627

CodePudding user response:

From the top down! come

CodePudding user response:

Happy @ have a parrot

CodePudding user response:

Began keeping records in Excel macro, manual, complete the required function end record macros, press Alt + F11 key, check just record macro corresponding VBA code,

CodePudding user response:

I am as VBA to thinking, but when using vc, format can't replicate the past, sometimes copy sheet into a picture of the past

CodePudding user response:

//copy the source file Worksheet content
Bsheet. AttachDispatch (bsheets. The GetItem (_variant_t ((long) I)));
Brange. AttachDispatch (bsheet GetCells ());
//bsheet. Copy (vtMissing, _variant_t (bsheet));
Brange. Copy (vtMissing);
//bsheet. Copy (vtMissing);
//brange. AttachDispatch (bsheet GetCells ());
//brange. AttachDispatch (bsheet. GetRange (_variant_t (" A1 "), _variant_t (" Z30 ")));
//bsheet. Copy (vtMissing, vtMissing);//assign values to the clipboard
//bsheet. Copy (vtMissing, vtMissing);
//after the last Worksheet in the target file to insert the new Worksheet, at the same time in front of the paste copy content
Brange. ReleaseDispatch ();
Asheet. AttachDispatch (asheets. Add (vtMissing, _variant_t (lastsheet), vtMissing, vtMissing));
Asheet. Elegantly-named SetName (bsheet GetName ());
Asheet. AttachDispatch (asheets. The GetItem (_variant_t (bsheet. The GetName ())), true);



Arange. AttachDispatch (asheet. GetCells (), true);

Arange. Activate ();
Arange. The Select ();
Arange. PasteSpecial ((long), 13 (long) - 4142, vtMissing, vtMissing);
//asheet. PasteSpecial (_variant_t (asheet), _variant_t (asheet), vtMissing, vtMissing, vtMissing, vtMissing, vtMissing);
//arange. PasteSpecial ((long) 6, (long) - 4142, vtMissing, vtMissing);

//brange. PasteSpecial (xlPasteColumnWidths xlPasteSpecialOperationNone, vtMissing, vtMissing);//copy the column width
//brange. PasteSpecial (xlPasteFormats xlPasteSpecialOperationNone, vtMissing, vtMissing);//copy table format
//arange. Paste (vtMissing);
//bsheet. Activate ();

CodePudding user response:

Under his roof, is to use range1. First I copy method in excel1 reproduction in the use of worksheet. Pastespecial method in excel2 paste, but in the end in excel2 as image format, I need to excel format
  • Related