1
를 설정하지런타임 오류 91 개체 변수가
oApp.Namespace (FileNameZip) .CopyHere oApp.Namespace (FolderName은)는
는 내가 얻을 .items :
런타임 오류 91 개체 변수는
우편 Fi를 설정하지 파일이 압축되지 않고 작업 폴더에 작성됩니다. 내 변수를 검사했는데 변수가 올바르게 설정되어 있습니다.
Sub Zip_genie()
Dim FileNameZip, FolderName, oFolder
Dim strDate As String, DefPath As String
Dim oApp As Object
DefPath = "c:\users\" & Environ("Username") & "\documents\Appraiser_Genie\working\"
If Right(DefPath, 1) <> "\" Then
DefPath = DefPath & "\"
End If
ChDir DefPath
FileNameZip = "report.zip"
Set oApp = CreateObject("Shell.Application")
'Create empty Zip File
NewZip (FileNameZip)
FolderName = DefPath
Debug.Print (FolderName)
Debug.Print (FileNameZip)
'Copy the files to the compressed folder
oApp.Namespace(FileNameZip).CopyHere oApp.Namespace(FolderName).items
'Keep script waiting until Compressing is done
On Error Resume Next
Do Until oApp.Namespace(FileNameZip).items.count = _
oApp.Namespace(FolderName).items.count
Application.Wait (Now + TimeValue("0:00:01"))
Loop
On Error GoTo 0
'MsgBox "You find the zipfile here: " & FileNameZip
End Sub