你昨天不是问过几乎一样的问题吗?压缩文件夹只需要将文件名改为文件夹名称即可。Option Explicit
Dim strRARPath As String
Dim strCompresFile As String        '要压缩的文件路径
Dim strTargetFile As String         '压缩后的文件路径
Dim retval
Private Sub Command1_Click()
    Dim strP As String
    Dim lngP As Long
    strRARPath = "C:\Program Files\WinRAR\winrar.exe"   '执行压缩的可执行文件路径
    strCompresFile = "C:\1" '要压缩的文件路径
    strTargetFile = "C:\1.rar"  '压缩后的文件路径
    strP = strRARPath & " A " & strTargetFile & " " & strCompresFile    '压缩命令字符串
    lngP = Shell(strP, vbHide)  '执行压缩命令
End Sub
Private Sub Command2_Click()
    Dim strP As String
    Dim lngP As Long
    strRARPath = "C:\Program Files\WinRAR\winrar.exe"
    strTargetFile = "C:\1.rar"          '压缩文件路径
    strCompresFile = "C:\1\"             '解压缩后文件的位置
    strP = strRARPath & " X " & strTargetFile & " " & strCompresFile
    lngP = Shell(strP, vbHide)
End Sub