Question about Excel

Question about Excel

Postby driessen » Mon Oct 28, 2019 9:15 am

Hello,

I want to combine 2 cells to make a title on top of 2 columns,
You can see here an example. How can I make my title "Long title" possible from my FWH-application?

Image

Thanks a lot in advance.
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.02 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc77
User avatar
driessen
 
Posts: 1399
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Question about Excel

Postby ADutheil » Mon Oct 28, 2019 9:52 am

oSheet:Range( oSheet:Cells( 1, 1 ), oSheet:Cells( 1, 2 ) ):merge()
Regards,

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: Question about Excel

Postby driessen » Mon Oct 28, 2019 12:03 pm

Thank you very much for your help.

Can you tell me where I can find all this necessary information?
Regards,

Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.02 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc77
User avatar
driessen
 
Posts: 1399
Joined: Mon Oct 10, 2005 11:26 am
Location: Genk, Belgium

Re: Question about Excel

Postby ADutheil » Mon Oct 28, 2019 1:42 pm

I don't think there's an online complete guide for FW/Harbour. My advise is you search VBA + Excel and adapt your findings to Hb/Fw. That's the way I did. If you have other specific questions about this topic I may be able to answer because I've done many OLE routines. Here's a sample of function I use to export some data to Excel.
Code: Select all  Expand view
STATIC FUNCTION ExpToExcel( oMeter )
LOCAL oExcel := NIL
LOCAL oSheet := NIL
LOCAL oWorkb := NIL
LOCAL aRota
LOCAL nL         := 0
LOCAL nI
LOCAL aExep  := { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } } // exeções pdv radio santa rita, rotas 004800,005000,006000, GAZ SIMOES FILHO 2( reparte, linha planilha, qtd pdv )
LOCAL dData  := hora->DATA
LOCAL cStrg

hora->( dbGoTop() )
oMeter:nTotal := hora->( ordKeyCount() )
oExcel := win_oleCreateObject( "Excel.Application" )
oWorkb := oExcel:WorkBooks:Add()
IF oWorkb:Sheets():COUNT = 3
    oWorkb:Sheets( 3 ):delete()
    oWorkb:Sheets( 2 ):delete()
ENDIF
oSheet := oWorkb:Sheets( 1 )
oSheet:Name := "HORÁRIOS E OCORRENCIAS DA VAV"
oExcel:Visible = .F.
oSheet:Cells:Font:Size := 10
oSheet:Cells:Font:Name := "Arial"
oSheet:Cells:Font:Bold := .T.

oSheet:Rows( 1 ):RowHeight := 37
oSheet:Rows( 1 ):VerticalAlignment := xlCenter
oSheet:Rows( 1 ):HorizontalAlignment := xlCenter
oSheet:Range( oSheet:Cells( 1, 1 ), oSheet:Cells( 1, 7 ) ):Interior:ColorIndex := Violeta    
oSheet:Range( oSheet:Cells( 1, 1 ), oSheet:Cells( 1, 7 ) ):Font:ColorIndex := Branco
oSheet:Range( oSheet:Cells( 1, 8 ), oSheet:Cells( 1, 13 ) ):Interior:ColorIndex := Azul
oSheet:Range( oSheet:Cells( 1, 8 ), oSheet:Cells( 1, 13 ) ):Font:ColorIndex := Preto
oSheet:Range( oSheet:Cells( 1, 14 ), oSheet:Cells( 1, 28 ) ):Interior:ColorIndex := Vermelho
oSheet:Range( oSheet:Cells( 1, 14 ), oSheet:Cells( 1, 28 ) ):Font:ColorIndex := Preto

oSheet:Cells( 1,  1 ):value := "HORÁRIO DE DIST.VAV"
oSheet:Cells( 1,  1 ):Font:Size := 14
oSheet:Range( oSheet:Cells( 1, 1 ), oSheet:Cells( 1, 2 ) ):merge()
oSheet:Cells( 1,  3 ):value := "TOTAL TIRAGEM "
oSheet:Cells( 1,  3 ):Font:Size := 12
oSheet:Range( oSheet:Cells( 1, 3 ), oSheet:Cells( 1, 4 ) ):merge()
//oSheet:Cells( 1,  4 ):Value := "=soma( J3:J" +  allTrim( str( hora->( ordKeyCount() ) * 3 ) ) + ")"
oSheet:Cells( 1,  4 ):NumberFormat := "#.###"
oSheet:Cells( 1,  4 ):Font:Size := 20
oSheet:Cells( 1,  6 ):value := hora->DATA
oSheet:Cells( 1,  6 ):Font:Size := 11
oSheet:Cells( 1,  7 ):value := cdOW( hora->DATA )
oSheet:Cells( 1,  7 ):Font:Size := 11
oSheet:Cells( 1,  8 ):Font:Size := 11
oSheet:Range( oSheet:Cells( 1, 7 ), oSheet:Cells( 1, 8 ) ):merge()
oSheet:Cells( 1,  9 ):value := "INFORMAÇOES DA ROTA"
oSheet:Cells( 1,  9 ):Font:Size := 10
oSheet:Range( oSheet:Cells( 1, 9 ), oSheet:Cells( 1, 13 ) ):merge()
oSheet:Cells( 1,  14 ):value := "PREENCHIMENTO OBRIGATORIO QUANDO HOUVER ATRASO NA DISTRIBUIÇÃO E OCORRENCIAS NAS ROTAS"
oSheet:Cells( 1,  14 ):Font:Size := 10
//oSheet:Range( oSheet:Cells( 1, 1 ), oSheet:Cells( 1, 2 ) )    
oSheet:Range( oSheet:Cells( 1, 14 ), oSheet:Cells( 1, 28 ) ):merge()

oSheet:Rows( 2 ):RowHeight := 37
oSheet:Rows( 2 ):VerticalAlignment := xlCenter
oSheet:Rows( 2 ):HorizontalAlignment := xlCenter
oSheet:Rows( 2 ):WrapText := .T.

oSheet:Range( oSheet:Cells( 2, 1 ), oSheet:Cells( 2, 28 ) ):Interior:ColorIndex := Cinza  
oSheet:Range( oSheet:Cells( 2, 1 ), oSheet:Cells( 2, 28 ) ):Font:ColorIndex := Preto
oSheet:Range( oSheet:Cells( 2, 1 ), oSheet:Cells( 2, 28 ) ):Font:Size := 9

oSheet:Cells( 2,   1 ):value := "ROTA"
oSheet:Cells( 2,   2 ):value := "BAIRROS"
oSheet:Cells( 2,   3 ):value := "AMARAÇÃO"
oSheet:Cells( 2,   4 ):value := "SAÍDA CORREIO"
oSheet:Cells( 2,   5 ):value := "1ª Banca"
oSheet:Cells( 2,   6 ):value := "Ult banca"
oSheet:Cells( 2,   7 ):value := "Percurso"
oSheet:Cells( 2,   8 ):value := "Janela"
oSheet:Cells( 2,   9 ):value := "Qtd PDV`S da rota"
oSheet:Cells( 2,  10 ):value := "KM ROTA DISTRIBUIÇÃO"
oSheet:Cells( 2,  11 ):value := "Qtd de jornais   da rota"
oSheet:Cells( 2,  12 ):value := "PDV´S atendidos até 6:30"
oSheet:Cells( 2,  13 ):value := "%"
oSheet:Cells( 2,  14 ):value := "PDV´S atendidos após 6:31 até 7:30"
oSheet:Cells( 2,  15 ):value := "%"
oSheet:Cells( 2,  16 ):value := "PDV´S atendidos das 7:31 as 8:30"
oSheet:Cells( 2,  17 ):value := "%"
oSheet:Cells( 2,  18 ):value := "PDV´S atendidos após 8:30"
oSheet:Cells( 2,  19 ):value := "%"
oSheet:Cells( 2,  20 ):value := "Total PDV,S atendidos"
oSheet:Cells( 2,  21 ):value := "OCORRÊNCIAS DA ROTA - PREENCHIMENTO OBRIGATÓRIO "
oSheet:Range( oSheet:Cells( 2, 21 ), oSheet:Cells( 2, 28 ) ):merge()
oSheet:Columns( 1 ):ColumnWidth := 17
oSheet:Columns( 2 ):ColumnWidth := 42
oSheet:Columns( 3 ):ColumnWidth := 15
oSheet:Columns( 4 ):ColumnWidth := 15
oSheet:Columns( 5 ):ColumnWidth := 15
oSheet:Columns( 6 ):ColumnWidth := 14
oSheet:Columns( 7 ):ColumnWidth := 12.14
oSheet:Columns( 8 ):ColumnWidth := 10.43
oSheet:Columns( 9 ):ColumnWidth := 11.57
oSheet:Columns( 10 ):ColumnWidth := 12
oSheet:Columns( 11 ):ColumnWidth := 14.71
oSheet:Columns( 12 ):ColumnWidth := 14.29
oSheet:Columns( 13 ):ColumnWidth := 7.29
oSheet:Columns( 14 ):ColumnWidth := 15.86
oSheet:Columns( 15 ):ColumnWidth := 6.57
oSheet:Columns( 16 ):ColumnWidth := 15.86
oSheet:Columns( 17 ):ColumnWidth := 6.57

WHILE hora->( !eOF() )
   oMeter:Set( hora->( ordKeyNo() ) )
    SysRefresh()
    aRota := SomaTira( aExep, dData, hora->ROTA )
    nL := hora->( ordKeyNo() ) * 3
    oSheet:Rows( nL ):HorizontalAlignment := xlCenter
    oSheet:Range( oSheet:Cells( nL, 21 ), oSheet:Cells( nL, 28 ) ):merge()
    cStrg := subStr( hora->EXTR, 1, at( " ", hora->EXTR ) )
    oSheet:Cells( nL,  1 ):NumberFormat := "@"
    oSheet:Cells( nL,  1 ):value := cStrg// hora->ROTA
    oSheet:Cells( nL,  2 ):value := charRem( "-", strTran( hora->EXTR, cStrg, "" ) ) // hora->EXTR
    oSheet:Cells( nL,  3 ):value := hora->HAMA
    oSheet:Cells( nL,  4 ):value := hora->HSAI
    oSheet:Cells( nL,  4 ):Interior:ColorIndex := if( hora->HSAI < "04:00", Verde, Vermelho )
    oSheet:Cells( nL,  5 ):value := hora->H1PV
    oSheet:Cells( nL,  6 ):value := hora->HUPV
    oSheet:Cells( nL,  6 ):Interior:ColorIndex := if( hora->HUPV < "06:31", Verde, Vermelho )
    oSheet:Cells( nL,  7 ):value := if( "=F" + allTrim( str( nL ) ) > "E" + allTrim( str( nL ) ), "=F" + allTrim( str( nL ) ) + "-E" + allTrim( str( nL ) ), "=F" + allTrim( str( nL ) ) + "-E" + allTrim( str( nL ) ) + "+24" )// "=F" + allTrim( str( nL ) ) + "-E" + allTrim( str( nL ) )
    oSheet:Cells( nL,  8 ):value := if( "=F" + allTrim( str( nL ) ) > "D" + allTrim( str( nL ) ), "=F" + allTrim( str( nL ) ) + "-D" + allTrim( str( nL ) ), "=F" + allTrim( str( nL ) ) + "-D" + allTrim( str( nL ) ) + "+24" ) //"=F" + allTrim( str( nL ) ) + "-D" + allTrim( str( nL ) )
    oSheet:Cells( nL,  9 ):value := aRota[ 1 ]
    oSheet:Cells( nL, 10 ):value := hora->KMRT
    oSheet:Cells( nL, 11 ):value := aRota[ 2 ]
    oSheet:Cells( nL, 12 ):value := hora->QAT6
    oSheet:Cells( nL, 13 ):value := "=K" + allTrim( str( nL ) ) + "*1/H" + allTrim( str( nL ) )
    oSheet:Cells( nL, 13 ):NumberFormat := "###,##%"
    oSheet:Range( oSheet:Cells( nL, 12 ), oSheet:Cells( nL, 13 ) ):Interior:ColorIndex := Verde
    oSheet:Cells( nL, 14 ):value := hora->QAT7
    oSheet:Cells( nL, 15 ):value := "=M" + allTrim( str( nL ) ) + "*1/H" + allTrim( str( nL ) )
    oSheet:Cells( nL, 15 ):NumberFormat := "###,##%"
    oSheet:Range( oSheet:Cells( nL, 14 ), oSheet:Cells( nL, 15 ) ):Interior:ColorIndex := if( oSheet:Cells( nL, 14 ):value = 0, Verde, Vermelho )
    oSheet:Cells( nL, 16 ):value := hora->QAT8
    oSheet:Cells( nL, 17 ):value := "=O" + allTrim( str( nL ) ) + "*1/H" + allTrim( str( nL ) )
    oSheet:Cells( nL, 17 ):NumberFormat := "###,##%"
    oSheet:Range( oSheet:Cells( nL, 16 ), oSheet:Cells( nL, 17 ) ):Interior:ColorIndex := if( oSheet:Cells( nL, 16 ):value = 0, Verde, Vermelho )
    oSheet:Cells( nL, 18 ):value := hora->QAT9
    oSheet:Cells( nL, 19 ):value := "=Q" + allTrim( str( nL ) ) + "*1/H" + allTrim( str( nL ) )
    oSheet:Cells( nL, 19 ):NumberFormat := "###,##%"
    oSheet:Range( oSheet:Cells( nL, 18 ), oSheet:Cells( nL, 19 ) ):Interior:ColorIndex := if( oSheet:Cells( nL, 18 ):value = 0, Verde, Vermelho )
    oSheet:Cells( nL, 20 ):value := "=(K" + allTrim( str( nL ) ) + "+M" + allTrim( str( nL ) ) + "+O" + allTrim( str( nL ) ) + "+Q" + allTrim( str( nL ) ) + ")*1/H" + allTrim( str( nL ) )
    oSheet:Cells( nL, 20 ):NumberFormat := "###,##%"
    oSheet:Cells( nL, 21 ):value := if( hora->OCOR == "S", hora->OBSE, "NÃO" )
    oSheet:Cells( nL, 21 ):Interior:ColorIndex := if( hora->OCOR == "S", Vermelho, Verde )
    //oSheet:Cells( nL, 22 ):value := hora->OBSE
    FOR nI := 1 TO 28
        oSheet:Range( oSheet:Cells( nL, nI ), oSheet:Cells( nL + 2, nI ) ):merge()
        oSheet:Range( oSheet:Cells( nL, nI ), oSheet:Cells( nL + 2, nI ) ):VerticalAlignment := xlCenter
    NEXT
    IF hora->ROTA == "999999"
        aExep[ 1, 2 ] := nL
    ENDIF
    IF hora->ROTA == "999998"
        aExep[ 5, 2 ] := nL
    ENDIF
    IF hora->ROTA == "004001"
        aExep[ 2, 2 ] := nL
    ENDIF
    IF hora->ROTA == "003301"
        aExep[ 3, 2 ] := nL
    ENDIF
    IF hora->ROTA == "005900"
        aExep[ 4, 2 ] := nL
    ENDIF
    hora->( dbSkip() )
ENDDO
//8 = pdv 10 = jornais
// caso radio santa rita
IF aExep[ 2, 2 ] != 0
    oSheet:Cells( aExep[ 1, 2 ],  8 ):value := aExep[ 1, 3 ]
    oSheet:Cells( aExep[ 1, 2 ], 10 ):value := aExep[ 1, 1 ]
ENDIF
// caso rota 004800 soma com 004001
SomaTira( aExep, dData, "004800" )
IF aExep[ 2, 2 ] != 0
    oSheet:Cells( aExep[ 2, 2 ],  8 ):value += aExep[ 2, 3 ]
    oSheet:Cells( aExep[ 2, 2 ], 10 ):value += aExep[ 2, 1 ]
ENDIF
// caso rota 005000 soma com 003301
SomaTira( aExep, dData, "005000" )
IF aExep[ 3, 2 ] != 0
    oSheet:Cells( aExep[ 3, 2 ],  8 ):value += aExep[ 3, 3 ]
    oSheet:Cells( aExep[ 3, 2 ], 10 ):value += aExep[ 3, 1 ]
ENDIF

// caso rota 006000 soma com 005900
SomaTira( aExep, dData, "006000" )
IF aExep[ 4, 2 ] != 0
    oSheet:Cells( aExep[ 4, 2 ],  8 ):value += aExep[ 4, 3 ]
    oSheet:Cells( aExep[ 4, 2 ], 10 ):value += aExep[ 4, 1 ]
ENDIF

// caso gazeteiro Simões Filho
IF aExep[ 5, 2 ] != 0
    oSheet:Cells( aExep[ 5, 2 ],  8 ):value += aExep[ 5, 3 ]
    oSheet:Cells( aExep[ 5, 2 ], 10 ):value += aExep[ 5, 1 ]
ENDIF

oSheet:Cells( 1,  5 ):Value := "=soma( K3:K" +  allTrim( str( hora->( ordKeyCount() ) * 3 ) ) + ")" + if( aExep[ 1, 2 ] != 0, "- K" + allTrim( str( aExep[ 1, 2 ] ) ), "" ) + if( aExep[ 5, 2 ] != 0, " - K" + allTrim( str( aExep[ 5, 2 ] ) ), "" )


oSheet:Range( oSheet:Cells( 3, 22 ), oSheet:Cells( hora->( ordKeyCount() ) * 3, 28 ) ):Font:Bold := .F.
oSheet:Range( oSheet:Cells( 1, 1 ), oSheet:Cells( hora->( ordKeyCount() ) * 3, 28 ) ):Borders( xlInsideHorizontal ):LineStyle := xlContinuous
oSheet:Range( oSheet:Cells( 1, 1 ), oSheet:Cells( hora->( ordKeyCount() ) * 3, 28 ) ):Borders( xlInsideHorizontal ):Weight := xlThin
oSheet:Range( oSheet:Cells( 1, 1 ), oSheet:Cells( hora->( ordKeyCount() ) * 3 + 2, 28 ) ):Borders( xlInsideVertical ):LineStyle := xlContinuous
oSheet:Range( oSheet:Cells( 1, 1 ), oSheet:Cells( hora->( ordKeyCount() ) * 3 + 2, 28 ) ):Borders( xlInsideVertical ):Weight := xlThin
oSheet:Range( oSheet:Cells( 1, 1 ), oSheet:Cells( hora->( ordKeyCount() ) * 3 + 2, 28 ) ):Borders( xlEdgeBottom ):LineStyle := xlContinuous
oSheet:Range( oSheet:Cells( 1, 1 ), oSheet:Cells( hora->( ordKeyCount() ) * 3 + 2, 28 ) ):Borders( xlEdgeBottom ):Weight := xlThin
oSheet:Range( oSheet:Cells( 1, 1 ), oSheet:Cells( hora->( ordKeyCount() ) * 3 + 2, 28 ) ):Borders( xlEdgeRight ):LineStyle := xlContinuous
oSheet:Range( oSheet:Cells( 1, 1 ), oSheet:Cells( hora->( ordKeyCount() ) * 3 + 2, 28 ) ):Borders( xlEdgeRight ):Weight := xlThin
oSheet:Range( oSheet:Cells( 1, 1 ), oSheet:Cells( hora->( ordKeyCount() ) * 3 + 2, 28 ) ):Borders( xlEdgeTop ):LineStyle := xlContinuous
oSheet:Range( oSheet:Cells( 1, 1 ), oSheet:Cells( hora->( ordKeyCount() ) * 3 + 2, 28 ) ):Borders( xlEdgeTop ):Weight := xlThin
oSheet:Range( oSheet:Cells( 1, 1 ), oSheet:Cells( hora->( ordKeyCount() ) * 3 + 2, 28 ) ):Borders( xlEdgeLeft ):LineStyle := xlContinuous
oSheet:Range( oSheet:Cells( 1, 1 ), oSheet:Cells( hora->( ordKeyCount() ) * 3 + 2, 28 ) ):Borders( xlEdgeLeft ):Weight := xlThin

nL += 4
oSheet:Rows( nL ):VerticalAlignment := xlCenter
oSheet:Rows( nL ):HorizontalAlignment := xlCenter
oSheet:Range( oSheet:Cells( nL, 1 ), oSheet:Cells( nL, 28 ) ):Interior:ColorIndex := AzulClaro
oSheet:Range( oSheet:Cells( nL, 1 ), oSheet:Cells( nL, 28 ) ):Font:ColorIndex := Preto


//oSheet:Range( oSheet:Cells( nL, 1 ), oSheet:Cells( nL, 10 ) ):Interior:ColorIndex := AzulClaro
//oSheet:Range( oSheet:Cells( nL, 1 ), oSheet:Cells( nL, 10 ) ):Font:ColorIndex := Preto
oSheet:Cells( nL, 1 ):Value := "QUADRO DE LEGENDAS"
oSheet:Range( oSheet:Cells( nL, 1 ), oSheet:Cells( nL, 3 ) ):merge()


//oSheet:Range( oSheet:Cells( nL, 4 ), oSheet:Cells( nL, 9 ) ):Interior:ColorIndex := AzulClaro
//oSheet:Range( oSheet:Cells( nL, 4 ), oSheet:Cells( nL, 9 ) ):Font:ColorIndex := Preto
oSheet:Cells( nL, 6 ):Value := "QUADRO DE LEGENDAS"
oSheet:Range( oSheet:Cells( nL, 4 ), oSheet:Cells( nL, 9 ) ):merge()

//oSheet:Range( oSheet:Cells( nL, 11 ), oSheet:Cells( nL, 17 ) ):Interior:ColorIndex := AzulClaro
//oSheet:Range( oSheet:Cells( nL, 11 ), oSheet:Cells( nL, 17 ) ):Font:ColorIndex := Preto
oSheet:Cells( nL, 11 ):Value := "QUADRO DE LEGENDAS"
oSheet:Range( oSheet:Cells( nL, 11 ), oSheet:Cells( nL, 17 ) ):merge()

//oSheet:Range( oSheet:Cells( nL, 22 ), oSheet:Cells( nL, 28 ) ):Interior:ColorIndex := AzulClaro
//oSheet:Range( oSheet:Cells( nL, 22 ), oSheet:Cells( nL, 28 ) ):Font:ColorIndex := Preto
oSheet:Cells( nL, 22 ):Value := "QUADRO DE LEGENDAS"
oSheet:Range( oSheet:Cells( nL, 22 ), oSheet:Cells( nL, 28 ) ):merge()

nL += 1
oSheet:Rows( nL ):VerticalAlignment := xlCenter
oSheet:Rows( nL ):HorizontalAlignment := xlCenter
oSheet:Range( oSheet:Cells( nL, 1 ), oSheet:Cells( nL, 28 ) ):Interior:ColorIndex := Cinza
oSheet:Range( oSheet:Cells( nL, 1 ), oSheet:Cells( nL, 28 ) ):Font:ColorIndex := Preto
oSheet:Cells( nL, 1 ):Value := "Saída Correio"
oSheet:Range( oSheet:Cells( nL, 1 ), oSheet:Cells( nL, 3 ) ):merge()
oSheet:Cells( nL, 5 ):Value := "Ult. Banca"
oSheet:Range( oSheet:Cells( nL, 4 ), oSheet:Cells( nL, 9 ) ):merge()

//oSheet:Range( oSheet:Cells( nL, 11 ), oSheet:Cells( nL, 17 ) ):Interior:ColorIndex := Cinza
//oSheet:Range( oSheet:Cells( nL, 11 ), oSheet:Cells( nL, 17 ) ):Font:ColorIndex := Preto
oSheet:Cells( nL, 11 ):Value := "PDV´S atendidos até 6:30"
oSheet:Range( oSheet:Cells( nL, 11 ), oSheet:Cells( nL, 17 ) ):merge()

//oSheet:Range( oSheet:Cells( nL, 22 ), oSheet:Cells( nL, 28 ) ):Interior:ColorIndex := Cinza
//oSheet:Range( oSheet:Cells( nL, 22 ), oSheet:Cells( nL, 28 ) ):Font:ColorIndex := Preto
oSheet:Cells( nL, 22 ):Value := "OCORRÊNCIAS DA ROTA - PREENCHIMENTO OBRIGATÓRIO"
oSheet:Range( oSheet:Cells( nL, 22 ), oSheet:Cells( nL, 28 ) ):merge()

nL += 1
oSheet:Rows( nL ):VerticalAlignment := xlCenter
oSheet:Rows( nL ):HorizontalAlignment := xlCenter
oSheet:Rows( nL ):RowHeight := 30
oSheet:Rows( nL ):WrapText := .T.
oSheet:Range( oSheet:Cells( nL, 1 ), oSheet:Cells( nL, 1 ) ):Interior:ColorIndex := Vermelho
oSheet:Cells( nL, 2 ):Value := "FORA DO HORÁRIO EXPEDIÇÃO (ATRASADO)"
oSheet:Range( oSheet:Cells( nL, 2 ), oSheet:Cells( nL, 3 ) ):merge()
oSheet:Range( oSheet:Cells( nL, 4 ), oSheet:Cells( nL, 4 ) ):Interior:ColorIndex := Vermelho
oSheet:Cells( nL, 5 ):Value := "JORNAL ENTREGUE FORA DO HORARIO LIMITE APÓS 6:30"
oSheet:Range( oSheet:Cells( nL, 5 ), oSheet:Cells( nL, 8 ) ):merge()

oSheet:Range( oSheet:Cells( nL, 10 ), oSheet:Cells( nL, 10 ) ):Interior:ColorIndex := Vermelho
oSheet:Cells( nL, 11 ):Value := "FORA DO HORÁRIO EXPEDIÇÃO (ATRASADO)"
oSheet:Range( oSheet:Cells( nL, 11 ), oSheet:Cells( nL, 16 ) ):merge()

oSheet:Range( oSheet:Cells( nL, 21 ), oSheet:Cells( nL, 21 ) ):Interior:ColorIndex := Vermelho
oSheet:Cells( nL, 22 ):Value := "QUANDO HOUVER OCORRENCIAS NA ROTA DE DISTRIBUIÇÃO"
oSheet:Range( oSheet:Cells( nL, 22 ), oSheet:Cells( nL, 28 ) ):merge()

nL += 1
oSheet:Rows( nL ):VerticalAlignment := xlCenter
oSheet:Rows( nL ):HorizontalAlignment := xlCenter
oSheet:Rows( nL ):RowHeight := 30
oSheet:Rows( nL ):WrapText := .T.
oSheet:Range( oSheet:Cells( nL, 1 ), oSheet:Cells( nL, 1 ) ):Interior:ColorIndex := Verde
oSheet:Cells( nL, 2 ):Value := "DENTRO DA GRADE DE HORARIO DE EXPEDIÇÃO"
oSheet:Range( oSheet:Cells( nL, 2 ), oSheet:Cells( nL, 3 ) ):merge()
oSheet:Range( oSheet:Cells( nL, 4 ), oSheet:Cells( nL, 4 ) ):Interior:ColorIndex := Verde
oSheet:Cells( nL, 5 ):Value := "JORNAL ENTREGUE DENTRO DO HORARIO LIMITE ATÉ 6:30"
oSheet:Range( oSheet:Cells( nL, 5 ), oSheet:Cells( nL, 8 ) ):merge()

oSheet:Range( oSheet:Cells( nL, 10 ), oSheet:Cells( nL, 10 ) ):Interior:ColorIndex := Verde
oSheet:Cells( nL, 11 ):Value := "DENTRO DA GRADE DE HORARIO DE EXPEDIÇÃO"
oSheet:Range( oSheet:Cells( nL, 11 ), oSheet:Cells( nL, 16 ) ):merge()

oSheet:Range( oSheet:Cells( nL, 21 ), oSheet:Cells( nL, 21 ) ):Interior:ColorIndex := Verde
oSheet:Cells( nL, 22 ):Value := "QUANDO NÃO HOUVER OCORRENCIAS NA ROTA"
oSheet:Range( oSheet:Cells( nL, 22 ), oSheet:Cells( nL, 28 ) ):merge()

oSheet:Cells( 1, 1 ):Select()
oExcel:Visible = .T.
hora->( dbGoTop() )
RETURN ( NIL )
 
Regards,

André Dutheil
FWH 13.04 + HB 3.2 + MSVS 10
ADutheil
 
Posts: 368
Joined: Sun May 31, 2009 6:25 pm
Location: Salvador - Bahia - Brazil

Re: Question about Excel

Postby hua » Mon Oct 28, 2019 5:15 pm

driessen wrote:Can you tell me where I can find all this necessary information?


Create a macro in Excel and look at the generated VBA.

See http://wiki.fivetechsoft.com/doku.php?i ... aq&s=excel . There are 2 links to excel related FAQ that you can use as a starting point
FWH 11.08/FWH 19.12
BCC5.82/BCC7.3
xHarbour/Harbour
hua
 
Posts: 1055
Joined: Fri Oct 28, 2005 2:27 am


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 66 guests