Ir ao conteúdo
  • Cadastre-se

Código Impressão Excel VBA - Windows 8/Office 2010


Posts recomendados

Bom dia!

 

Eu tenho um código para imprimir em PDF no Excel, entretanto, não funciona no Windows 8/Office 2010.

 

Poderiam me ajudar, por favor?

 

 

 

=============================================================================================================================

Sub PDF()
 
Dim Nome As String
Dim SDate As String
Dim MyLocal As String
 
MyLocal = "G:\INTERNACIONAL\SI -MODELO DE  INSTRUÇÃO DE EMBARQUE\MODELO NOVO SI MARÍTIMA FCL - 2015\PDF\"
Nome = Range("AB12").Value
Export = Range("T12").Value
Agent = Range("AB10").Value
PO = Range("AB6").Value
SDate = Now
 
If MsgBox("Gerar PDF", vbYesNo) = vbYes Then
Nome_Arq = MyLocal & "SI FCL --- " & Nome & " --- " & Export & " --- " & Agent & " --- " & PO & " --- " & Day(Now) & "-" & Month(Now) & "-" & Year(Now) & ".pdf"
Sheets("SEA FCL - SHIPPING INSTRUCTIONS").ExportAsFixedFormat Filename:=Nome_Arq, Type:=xlTypePDF, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
True
Application.DisplayAlerts = False
Else
Application.DisplayAlerts = False
End If
 
End Sub
================================================================================================================================
Link para o comentário
Compartilhar em outros sites

Wendell,

 

Ele deu erro e mostrou a depuração no VBA na linha(ficou amarelo):

 

 

 

Sheets("SEA FCL - SHIPPING INSTRUCTIONS").ExportAsFixedFormat Filename:=Nome_Arq, Type:=xlTypePDF, Quality:=xlQualityStandard, _
IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:= _
Link para o comentário
Compartilhar em outros sites

Bom dia MooM,
 
Por favor, verifique se este código deu certo para você, alterei algumas coisas aqui para ele funcionar:
 

--------------------------------------------------

Sub PDF()
 
Dim Nome As String
Dim SDate As String
Dim MyLocal As String
 
Nome_Arq = MyLocal & "SI FCL --- " & Nome & " --- " & Export & " --- " & Agent & " --- " & PO & " --- " & Day(Now) & _
"-" & Month(Now) & "-" & Year(Now) & ".pdf"
 
MyLocal = "G:\INTERNACIONAL\SI -MODELO DE  INSTRUÇÃO DE EMBARQUE\MODELO NOVO SI MARÍTIMA FCL - 2015\PDF\"
Nome = Range("AB12").Value
Export = Range("T12").Value
Agent = Range("AB10").Value
PO = Range("AB6").Value
SDate = Now
 
If MsgBox("Gerar PDF", vbYesNo) = vbYes Then
Sheets("SEA FCL - SHIPPING INSTRUCTIONS").Select
Selection.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Nome_Arq, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
OpenAfterPublish:=True
Application.DisplayAlerts = False
Else
Application.DisplayAlerts = False
End If
 
End Sub

------------------------------------------

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novas respostas.

Sobre o Clube do Hardware

No ar desde 1996, o Clube do Hardware é uma das maiores, mais antigas e mais respeitadas comunidades sobre tecnologia do Brasil. Leia mais

Direitos autorais

Não permitimos a cópia ou reprodução do conteúdo do nosso site, fórum, newsletters e redes sociais, mesmo citando-se a fonte. Leia mais

×
×
  • Criar novo...