WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

OLE with Excel
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

CopyFromRecordset Loss of Formatting

 Keywords: CopyFromRecordset Loss Destroy Removes Format Formatting ClipPut PasteSpecial

Something to be archived to lessons_learned:

I was asked to produce over 130 individual workbooks containing calculations for commissions on tab1 and work order detail on tab2. Several metrics are then combined to create rows in a summary workbook which is ranked and color-coded by quintiles. Using templates and a WB exe, there were no issues until filling and sorting the 11 tabs in the summary workbook (2 tabs for markets, 9 for supervisors). Obviously, storing the summary data into a temp table while creating the individual workbooks then selecting based on the critera (either the market, or supervisor ID) then using CopyFromRecordset to populate Excel seemed the ticket. Unfortunately CopyFromRecordset destroys the formatting in the template. The workaround which is not all that bad:

If ! oRS.eof()
   nRecs=oRS.RecordCount
   ClipPut("")
   ClipPut(oRS.GetString(2,,@TAB,@CRLF,""))
   oWS.Range("A2").PasteSpecial
   oXL.CutCopyMode=@FALSE
Endif

Article ID:   W18102
Filename:   CopyFromRecordset Loss of Formatting.txt
File Created: 2013:01:07:09:40:24
Last Updated: 2013:01:07:09:40:24