Advertisement
Guest User

Untitled

a guest
Jan 8th, 2019
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Private Sub CommandButton7_Click()
  2.  
  3. [...]
  4.  
  5.                If OptionButton1.Value = True Then
  6.                   strZipPath = tbxFilePathLF
  7.                   strZipName = "access_logfile_" & strEDate & ".txt.gz"
  8.                ElseIf OptionButton2.Value = True Then
  9.                   strZipPath = tbxFilePathLF
  10.                   strZipName = "error_logfile_" & strEDate & ".txt.gz"
  11.                   errorLogFile = Split(strURL, "file=")
  12.                   errorFile = Split(errorLogFile(1), ".")
  13.                End If
  14.                
  15.             CopyURLToFile strURL, strZipPath & strZipName
  16.             DeleteUrlCacheEntry (strURL)
  17.            
  18.             Exit For
  19.          End If
  20.     Next objLink
  21.  
  22.  
  23.     On Error GoTo Fin
  24.    
  25.     strZip = ThisWorkbook.Path & "\7za.exe"
  26.     strPathZ = tbxFilePathLF
  27.     gzFile = strZipPath & strZipName
  28.     strFileName = gzFile
  29.     strArg = strZip & " e -pHIDE " & strFileName & " -y -o" & strZipPath
  30.    
  31.     ShellAndWait strArg
  32.    
  33. [...]
  34.  
  35. End Sub
  36.  
  37. Private Sub ShellAndWait(ByVal strPathName As String)
  38.     Dim WshShell As Object
  39.     On Error GoTo Fin
  40.     Set WshShell = CreateObject("WScript.Shell")
  41.     WshShell.Run strPathName, 0, True
  42. Fin:
  43.     Set WshShell = Nothing
  44.     If Err.Number <> 0 Then MsgBox "Error: " & _
  45.         Err.Number & " " & Err.Description
  46. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement