O
ondaWall
I am trying to write a routine that will zip a .htm document, but
running into difficulty using the Shell method. The following will not
compile. It errors on the shell statement. I cant even get the shell
to open an instance of notepad. Many thanks in advance for replies.
Private Sub cmdTest_Click()
Dim pathWinZip As String, fileZipName As String
Dim fileToZip As String
Dim shellStr As String
On Error GoTo ErrorHandler
fileZipName = "C:\imhere.zip"
fileToZip = "C:\yadda.htm"
pathWinZip = "C:\program files\winzip\"
If Dir(pathWinZip & "winzip32.exe") = "" Then
MsgBox "Please install winzip and try again"
Exit Sub
End If
shellStr = pathWinZip & "winzip32.exe -min -a" _
& " " & Chr(34) & fileZipName & Chr(34) _
& " " & Chr(34) & fileToZip & Chr(34)
Shell(shellStr, 0) 'the compile stops here
Exit Sub
running into difficulty using the Shell method. The following will not
compile. It errors on the shell statement. I cant even get the shell
to open an instance of notepad. Many thanks in advance for replies.
Private Sub cmdTest_Click()
Dim pathWinZip As String, fileZipName As String
Dim fileToZip As String
Dim shellStr As String
On Error GoTo ErrorHandler
fileZipName = "C:\imhere.zip"
fileToZip = "C:\yadda.htm"
pathWinZip = "C:\program files\winzip\"
If Dir(pathWinZip & "winzip32.exe") = "" Then
MsgBox "Please install winzip and try again"
Exit Sub
End If
shellStr = pathWinZip & "winzip32.exe -min -a" _
& " " & Chr(34) & fileZipName & Chr(34) _
& " " & Chr(34) & fileToZip & Chr(34)
Shell(shellStr, 0) 'the compile stops here
Exit Sub