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.
Por CAMILOALVES
Posts
#42209
A Macro abaixo funciona da seguinte forma: converte a planilha para .PDF, porém sempre que acionada sobrescreve o arquivo anterior.
PEDIDO DE AJUDA: sempre que acionada nunca sobrescreva o arquivo anterior (que deve ser mantido a título de histórico) e sim gere um novo arquivo como se fosse uma versão.
Desde já agradeço
Segue a macro em questão:

Sub CONVERTER_EM_PDF()
Dim seuPdfCaminho As String
Dim seuPdfNome As String

seuPdfCaminho = "N:\TRANSPORTADORA SAMELO\Demostrativo de Resultado\"
seuPdfNome = "DIRETORIA.pdf"

ThisWorkbook.ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
seuPdfCaminho & seuPdfNome, Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
End Sub
Por kiko
Posts
#42211
CAMILOALVES boa tarde, a macro abaixo funciona da seguinte forma: converte a planilha para .PDF, e será mantido a título de histórico + a data atual + a hora e minuto atual e assim gera um novo arquivo como se fosse uma versão.
Espero ter ajudado.

Sub CONVERTER_EM_PDF()
Dim seuPdfCaminho As String
Dim seuPdfNome As String

seuPdfCaminho = "N:\TRANSPORTADORA SAMELO\Demostrativo de Resultado\"
seuPdfNome = "DIRETORIA" & Format(Now(), "DD-MMM-YYYY-hh-mm") & ".pdf"

ThisWorkbook.ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
seuPdfCaminho & seuPdfNome, Quality:= _
xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=False
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