Jump to content

Baixar Resultados Da Lotofacil Via Vba


Recommended Posts

  • 1 month later...

BAIXAR O ARQUIVO ZIP

 

i:\ = PEN DRIVE

 

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 Sub CommandButton1_Click()
    On Error GoTo Err
    Dim Auxiliar As Long
    Dim URL As String
    Dim CaminhoLocal As String
    Dim x
    For x = 1 To 8
        If x = 1 Then
            CaminhoLocal = "i:\d_lotfac.zip"
        ElseIf x = 2 Then
            CaminhoLocal = "i:\D_lotoma.zip"
        ElseIf x = 3 Then
            CaminhoLocal = "i:\d_loteca.zip"
        ElseIf x = 4 Then
            CaminhoLocal = "i:\d_lotogo.zip"
        ElseIf x = 5 Then
            CaminhoLocal = "i:\D_megase.zip"
        ElseIf x = 6 Then
            CaminhoLocal = "i:\D_quina.zip"
        ElseIf x = 7 Then
            CaminhoLocal = "i:\d_dplsen.zip"
        ElseIf x = 8 Then
            CaminhoLocal = "i:\D_timema.zip"
        End If
        Auxiliar = URLDownloadToFile(0, URL, CaminhoLocal, 0, 0)
    Next
    MsgBox "Download efetuado com sucesso!"
    Exit Sub
Err:
    MsgBox "Erro no download do arquivo"
End Sub
Edited by eduardodp
  • Like 2
Link to comment
Share on other sites


DESCOMPACTAÇÃO DOS ARQUIVOS

 

i:\ = PEN DRIVE

 

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 Sub CommandButton1_Click()

    Dim oApp As Object 'Objeto application

    Dim Arquivo As Variant

    Dim NovaPasta As Variant

    Dim Caminho As String

    Dim strDate As String

    Dim x

    Caminho = "i:\"

    strDate = Format(Now, "dd-mm-yy h-mm-ss")

    NovaPasta = Caminho & "LOTERIAS DA CAIXA " & strDate & "\"

    MkDir NovaPasta

    For x = 1 To 8

        If x = 1 Then

            Arquivo = caminho & "D_lotfac.zip"

        ElseIf x = 2 Then

            Arquivo = caminho & "D_lotoma.zip"

        ElseIf x = 3 Then

            Arquivo = caminho & "D_loteca.zip"

        ElseIf x = 4 Then

            Arquivo = caminho & "D_lotogo.zip"

        ElseIf x = 5 Then

            Arquivo = caminho & "D_megase.zip"

        ElseIf x = 6 Then

            Arquivo = caminho & "D_quina.zip"

        ElseIf x = 7 Then

            Arquivo = caminho & "D_dplsen.zip"

        ElseIf x = 8 Then

            Arquivo = caminho & "D_timema.zip"

        End If

        Set oApp = CreateObject("Shell.Application")

        oApp.Namespace(NovaPasta).CopyHere oApp.Namespace(Arquivo).items

    Next

End Sub

Edited by eduardodp
  • Like 2
Link to comment
Share on other sites

  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...