Postada em 05/04/2007 11:33 hs
Po colega, continuei boiando, sinceramente, não entendi, e tambem, não consegui colocar em prática isso no meu projeto, coloquei o codigo aqui em baixo da parte da geração para você me da uma luz.... Obrigadão
' ============================== < GERAÇÃO EXCEL > ============================== Dim objExcel As Object ' Excel Application Dim objBook As Object ' Excel WorkBook Dim objSheet As Object ' Excel WorkSheet Set objExcel = CreateObject("excel.application") 'Inicia a sessão do Excel Set objBook = objExcel.Workbooks.Add 'Adiciona a Workbook (Arquivo) Set objSheet = objBook.Worksheets.Item(1) 'Seleciona a Sheet (Plano) objExcel.Application.Visible = True
LINHA = 1 coluna = 1 With objExcel.Application .Cells(LINHA, 2).Value = "PERGUNTA 1": .Cells(1, 1).Interior.ColorIndex = 1: .Cells(1, 1).Font.ColorIndex = 2: .Cells(1, 1).Font.Bold = True .Cells(LINHA, 2).Value = "PERGUNTA 1": .Cells(LINHA, 2).Interior.ColorIndex = 1: .Cells(LINHA, 2).Font.ColorIndex = 2: .Cells(LINHA, 2).Font.Bold = True .Cells(LINHA, 3).Value = "PERGUNTA 2": .Cells(LINHA, 3).Interior.ColorIndex = 1: .Cells(LINHA, 3).Font.ColorIndex = 2: .Cells(LINHA, 3).Font.Bold = True .Cells(LINHA, 4).Value = "PERGUNTA 3": .Cells(LINHA, 4).Interior.ColorIndex = 1: .Cells(LINHA, 4).Font.ColorIndex = 2: .Cells(LINHA, 4).Font.Bold = True .Cells(LINHA, 5).Value = "PERGUNTA 4": .Cells(LINHA, 5).Interior.ColorIndex = 1: .Cells(LINHA, 5).Font.ColorIndex = 2: .Cells(LINHA, 5).Font.Bold = True .Cells(LINHA, 6).Value = "PERGUNTA 5": .Cells(LINHA, 6).Interior.ColorIndex = 1: .Cells(LINHA, 6).Font.ColorIndex = 2: .Cells(LINHA, 6).Font.Bold = True End With With objExcel.Application .Cells(2, coluna).Value = "RUIM": .Cells(2, coluna).Interior.ColorIndex = 1: .Cells(2, coluna).Font.ColorIndex = 2: .Cells(2, coluna).Font.Bold = True .Cells(3, coluna).Value = "REGULAR": .Cells(3, coluna).Interior.ColorIndex = 1: .Cells(3, coluna).Font.ColorIndex = 2: .Cells(3, coluna).Font.Bold = True .Cells(4, coluna).Value = "BOM": .Cells(4, coluna).Interior.ColorIndex = 1: .Cells(4, coluna).Font.ColorIndex = 2: .Cells(4, coluna).Font.Bold = True .Cells(5, coluna).Value = "OTIMO": .Cells(5, coluna).Interior.ColorIndex = 1: .Cells(5, coluna).Font.ColorIndex = 2: .Cells(5, coluna).Font.Bold = True .Cells(6, coluna).Value = "EXCELENTE": .Cells(6, coluna).Interior.ColorIndex = 1: .Cells(6, coluna).Font.ColorIndex = 2: .Cells(6, coluna).Font.Bold = True End With a = "A" b = "B" c = "C" d = "D" e = "E" f = "F" i = 2
With objExcel.Application .Cells(i, 2).Value = RESPARUIM If RESPARUIM = "" Then .Cells(i, 2).Value = 0 End If .Cells(i, 3).Value = RESPBRUIM If RESPBRUIM = "" Then .Cells(i, 3).Value = 0 End If .Cells(i, 4).Value = RESPCRUIM If RESPCRUIM = "" Then .Cells(i, 4).Value = 0 End If .Cells(i, 5).Value = RESPDRUIM If RESPDRUIM = "" Then .Cells(i, 5).Value = 0 End If .Cells(i, 6).Value = RESPERUIM If RESPERUIM = "" Then .Cells(i, 6).Value = 0 End If End With
i = 3 With objExcel.Application .Cells(i, 2).Value = RESPAREGULAR If RESPAREGULAR = "" Then .Cells(i, 2).Value = 0 End If .Cells(i, 3).Value = RESPBREGULAR If RESPBREGULAR = "" Then .Cells(i, 3).Value = 0 End If .Cells(i, 4).Value = RESPCREGULAR If RESPCREGULAR = "" Then .Cells(i, 4).Value = 0 End If .Cells(i, 5).Value = RESPDREGULAR If RESPDREGULAR = "" Then .Cells(i, 5).Value = 0 End If .Cells(i, 6).Value = RESPEREGULAR If RESPEREGULAR = "" Then .Cells(i, 6).Value = 0 End If End With
i = 4 With objExcel.Application .Cells(i, 2).Value = RESPABOM If RESPABOM = "" Then .Cells(i, 2).Value = 0 End If .Cells(i, 3).Value = RESPBBOM If RESPBBOM = "" Then .Cells(i, 3).Value = 0 End If .Cells(i, 4).Value = RESPCBOM If RESPCBOM = "" Then .Cells(i, 4).Value = 0 End If .Cells(i, 5).Value = RESPDBOM If RESPDBOM = "" Then .Cells(i, 5).Value = 0 End If .Cells(i, 6).Value = RESPEBOM If RESPEBOM = "" Then .Cells(i, 6).Value = 0 End If End With i = 5 With objExcel.Application .Cells(i, 2).Value = RESPAOTIMO If RESPAOTIMO = "" Then .Cells(i, 2).Value = 0 End If .Cells(i, 3).Value = RESPBOTIMO If RESPBOTIMO = "" Then .Cells(i, 3).Value = 0 End If .Cells(i, 4).Value = RESPCOTIMO If RESPCOTIMO = "" Then .Cells(i, 4).Value = 0 End If .Cells(i, 5).Value = RESPDOTIMO If RESPDOTIMO = "" Then .Cells(i, 5).Value = 0 End If .Cells(i, 6).Value = RESPEOTIMO If RESPEOTIMO = "" Then .Cells(i, 6).Value = 0 End If End With
i = 6 With objExcel.Application .Cells(i, 2).Value = RESPAEXCELENTE If RESPAEXCELENTE = "" Then .Cells(i, 2).Value = 0 End If .Cells(i, 3).Value = RESPBEXCELENTE If RESPBEXCELENTE = "" Then .Cells(i, 3).Value = 0 End If .Cells(i, 4).Value = RESPCEXCELENTE If RESPCEXCELENTE = "" Then .Cells(i, 4).Value = 0 End If .Cells(i, 5).Value = RESPDEXCELENTE If RESPDEXCELENTE = "" Then .Cells(i, 5).Value = 0 End If .Cells(i, 6).Value = RESPEEXCELENTE If RESPEEXCELENTE = "" Then .Cells(i, 6).Value = 0 End If End With
objExcel.Application.Cells.Columns.AutoFit objExcel.Application.Cells.Borders.LineStyle = 1 objExcel.Application.Cells.Borders.ColorIndex = 15 Range("B2:F6").Select Set Exlc = objExcel.Charts.Add Exlc.Legend.Position = xlLegendPositionBottom
Exlc.HasTitle = True Exlc.ChartTitle.Text = Combo1.Text Exlc.HasLegend = True objExcel.Save (Combo1.Text) Set objSheet = Nothing Set objBook = Nothing Set objExcel = Nothing Set Exlc = Nothing
' ==============================
Não comentei o código por ele em si ser de bem facil visualização, RESPARUIM, RESPBRUIM, RESPCRUIM .... SÃO VARIAVEIS DO SISTEMA !!!!!
Desde Já Agradeço . Alexandre
|