B@rney Posted August 31, 2012 Report Share Posted August 31, 2012 Utilizo uma função que pega dados do sistema e os preenche em uma planilha do Excel já previamente formatada e ao chegar no final da planilha se ainda possuir mais itens a ser preenchido será acrescentado uma nova linha para que o mesmo seja preenchido, e o meu problema é justamente este pois a plamilha junta 3 colunas mescladas e ao acrescentar a nova linha não é mantido a mescla e desconfigura as linhas acrescentadas, minha pergunta é tem como manter esta mescla ao acrescentar novas linhas pelo sistema em uma planilha em Excel? Quote Link to comment Share on other sites More sharing options...
B@rney Posted August 31, 2012 Author Report Share Posted August 31, 2012 Utilizo uma função que pega dados do sistema e os preenche em uma planilha do Excel já previamente formatada e ao chegar no final da planilha se ainda possuir mais itens a ser preenchido será acrescentado uma nova linha para que o mesmo seja preenchido, e o meu problema é justamente este pois a plamilha junta 3 colunas mescladas e ao acrescentar a nova linha não é mantido a mescla e desconfigura as linhas acrescentadas, minha pergunta é tem como manter esta mescla ao acrescentar novas linhas pelo sistema em uma planilha em Excel? Quote Link to comment Share on other sites More sharing options...
joaosolution Posted August 31, 2012 Report Share Posted August 31, 2012 Barney Em VBA seria assim: Range("A1:C1").Select 'Celulas a serem mescladas With Selection .HorizontalAlignment = xlCenter 'Centraliza .VerticalAlignment = xlBottom .WrapText = False .Orientation = 0 .AddIndent = False .IndentLevel = 0 .ShrinkToFit = False .ReadingOrder = xlContext .MergeCells = False End With Selection.Merge 'Mescla Att João Bosco Contagem/MG FWH 10.6b xHb 1.2.1 WorkShop 4.5 PellesC SQLLIB SQLRDD UltraEdit xDev MySql MS-Sql Quote Link to comment Share on other sites More sharing options...
vagner Posted August 31, 2012 Report Share Posted August 31, 2012 Olá, oAS:Range( cCIni+Alltrim(Str(nLiIn))+":"+cCFin+AllTrim(Str(nLiIn)) ):MergeCells := .T. Vagner Wirts "Ele não sabendo que era impossÃvel, foi lá e fez" Quote Link to comment Share on other sites More sharing options...
B@rney Posted September 3, 2012 Author Report Share Posted September 3, 2012 Ola Vagner tentei utlizar o que você postou mas da o seguinte erro : Class: 'NIL' has no property: MERGECELLS Alguem teria mais alguma dica? Quote Link to comment Share on other sites More sharing options...
vagner Posted September 3, 2012 Report Share Posted September 3, 2012 Olá, Como vc criou o objeto ? TRY oExcel := CreateObject( "Excel.Application" ) CATCH MsgStop("Excel não encontrado na máquina. [" + Ole2TxtError()+ "]" ) Retu(Nil) END oAS := oExcel:Worksheets( 1 ) id=code>id=code>Vagner Wirts "Ele não sabendo que era impossÃvel, foi lá e fez" Quote Link to comment Share on other sites More sharing options...
aferra Posted September 3, 2012 Report Share Posted September 3, 2012 Tente desta forma então oSheet:Range( "A1:C1" ):Merge() Um grande Abraço Alessandroid=blue> FW9.07 + xHb121 + CDX Fico feliz com os Meus erros, pois eles me apontam a direção para o acerto.id=red> Quote Link to comment Share on other sites More sharing options...
B@rney Posted September 4, 2012 Author Report Share Posted September 4, 2012 Bom gente agradeço a ajuda de todos.E ja consegui resolver o problema utilizando o metodo Duplicate , ele duplica a linha anterior mantendo suas propriedades. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.