Este fórum está sendo desativado

Depois de 9 anos, este fórum será desativado. Mas calma.... estamos migrando para uma comunidade no DISCORD. Junte-se a nós.

ENTRAR PARA DISCORD

Tópicos relacionados a códigos VBA, gravação de macros, etc.
#2553
Pessoal, gostaria muito da ajuda de vocês.

Eu rodei a rotina abaixo e ela me gera PDFs das abas selecionadas no listbox, porém essa rotina gera arquivos separados para cada aba. Preciso que a rotina me gere, para cada click no botão "Gerar PDF" apenas 1 PDF com todas as abas selecionadas. É possível?
Código: Selecionar todos
Private Sub CommandButton1_Click()
Dim i As Integer, Nome_Arquivo As String

'Conta os itens do listbox
For i = 0 To ListBox1.ListCount - 1
'Verifica se o item do listbox esta selecionado
'Se estiver selecionado continua a rotina
    If ListBox1.Selected(i) Then
        Nome_Arquivo = "C:\Relatórios\" & ListBox1.List(i) & ".pdf"
        Sheets(ListBox1.List(i)).Select
        If WorksheetFunction.CountA(Cells) = 0 Then
            'Exit Sub
        Else
        ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Nome_Arquivo, Quality _
        :=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
        OpenAfterPublish:=True
        End If
    End If
Next
End Sub




Private Sub UserForm_Initialize()
    Dim ws As Worksheet
    'Adiciona os Nomes das Abas no Listbox
        For Each ws In ThisWorkbook.Worksheets
                ListBox1.AddItem (ws.Name)
        Next ws
        
End Sub
long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]

Estamos migrando para uma comunidade no Discord