DOWNLOAD PDF

 Tópico anterior Próximo tópico Novo tópico

DOWNLOAD PDF

VB / VBA

 Compartilhe  Compartilhe  Compartilhe
#498089 - 09/09/2021 19:32:24

FAUZE
LONDRINA
Cadast. em:Junho/2009


Olá Pessoal,

Tenho um link que abre no navegador um arquivo PDF.
Gostaria de saber se tem uma maneira de chamar via código (VB6) e fazer o download sem abrir no navegador?

Obrigado,

Fauze

____________________________________________________________________________________
[]Muitos so os planos no corao do homem, mas o que prevalece o propsito do SENHOR.[] Pv 19.21


Resposta escolhida #498090 - 09/09/2021 19:45:07

FABRICIOWEB
BELO HORIZONTE
Cadast. em:Novembro/2011


Private Declare Function URLDownloadToFile Lib 'urlmon' _
   Alias 'URLDownloadToFileA' _
  (ByVal pCaller As Long, _
   ByVal szURL As String, _
   ByVal szFileName As String, _
   ByVal dwReserved As Long, _
   ByVal lpfnCB As Long) As Long

Private Const ERROR_SUCCESS As Long = 0
Private Const BINDF_GETNEWESTVERSION As Long = &H10
Private Const INTERNET_FLAG_RELOAD As Long = &H80000000

Public Function DownloadFile(sSourceUrl As String, _
                             sLocalFile As String) As Boolean

  //'Download the file. BINDF_GETNEWESTVERSION forces
  //'the API to download from the specified source.
  //'Passing 0& as dwReserved causes the locally-cached
  //'copy to be downloaded, if available. If the API
  //'returns ERROR_SUCCESS (0), DownloadFile returns True.
   DownloadFile = URLDownloadToFile(0&, _
                                    sSourceUrl, _
                                    sLocalFile, _
                                    BINDF_GETNEWESTVERSION, _
                                    0&) = ERROR_SUCCESS

End Function



#498091 - 10/09/2021 10:10:01

FAUZE
LONDRINA
Cadast. em:Junho/2009


Última edição em 10/09/2021 10:22:49 por FAUZE

Citação:
:
Private Declare Function URLDownloadToFile Lib 'urlmon' _
   Alias 'URLDownloadToFileA' _
  (ByVal pCaller As Long, _
   ByVal szURL As String, _
   ByVal szFileName As String, _
   ByVal dwReserved As Long, _
   ByVal lpfnCB As Long) As Long

Private Const ERROR_SUCCESS As Long = 0
Private Const BINDF_GETNEWESTVERSION As Long = &H10
Private Const INTERNET_FLAG_RELOAD As Long = &H80000000

Public Function DownloadFile(sSourceUrl As String, _
                             sLocalFile As String) As Boolean

  //'Download the file. BINDF_GETNEWESTVERSION forces
  //'the API to download from the specified source.
  //'Passing 0& as dwReserved causes the locally-cached
  //'copy to be downloaded, if available. If the API
  //'returns ERROR_SUCCESS (0), DownloadFile returns True.
   DownloadFile = URLDownloadToFile(0&, _
                                    sSourceUrl, _
                                    sLocalFile, _
                                    BINDF_GETNEWESTVERSION, _
                                    0&) = ERROR_SUCCESS

End Function

Boa dia Fabricio,
Obrigado pela atenção!
Funcionou!

Att,


Fauze

____________________________________________________________________________________
[]Muitos so os planos no corao do homem, mas o que prevalece o propsito do SENHOR.[] Pv 19.21


#498092 - 10/09/2021 10:41:47

FABRICIOWEB
BELO HORIZONTE
Cadast. em:Novembro/2011


Citação:
:
:
Private Declare Function URLDownloadToFile Lib 'urlmon' _
   Alias 'URLDownloadToFileA' _
  (ByVal pCaller As Long, _
   ByVal szURL As String, _
   ByVal szFileName As String, _
   ByVal dwReserved As Long, _
   ByVal lpfnCB As Long) As Long

Private Const ERROR_SUCCESS As Long = 0
Private Const BINDF_GETNEWESTVERSION As Long = &H10
Private Const INTERNET_FLAG_RELOAD As Long = &H80000000

Public Function DownloadFile(sSourceUrl As String, _
                             sLocalFile As String) As Boolean

  //'Download the file. BINDF_GETNEWESTVERSION forces
  //'the API to download from the specified source.
  //'Passing 0& as dwReserved causes the locally-cached
  //'copy to be downloaded, if available. If the API
  //'returns ERROR_SUCCESS (0), DownloadFile returns True.
   DownloadFile = URLDownloadToFile(0&, _
                                    sSourceUrl, _
                                    sLocalFile, _
                                    BINDF_GETNEWESTVERSION, _
                                    0&) = ERROR_SUCCESS

End Function
Boa dia Fabricio,
Obrigado pela atenção!
Funcionou!

Att,

finalize o topico entao meu amigo abraço



 Tópico anterior Próximo tópico Novo tópico


Tópico encerrado, respostas não sao permitidas
Encerrado por FAUZE em 10/09/2021 10:53:49