Excel VBA Shell.Namespace returns Nothing

后端 未结 2 502
[愿得一人]
[愿得一人] 2021-01-25 08:22

I\'m trying to extract a .CAB file using Excel VBA, but I\'m getting the following error:

Run-time error \'91\': Object variable or With block variable no

2条回答
  •  南方客
    南方客 (楼主)
    2021-01-25 09:02

    Your parameters must be submitted as Variant, not String

    Sub Tester()
    
        Dim src, dest                      '<< works
        'Dim src As String, dest As String '<< gives the error you see
    
        src = "D:\temp\test.zip"
        dest = "D:\temp\unzip"
    
        DeCab src, dest
    
    End Sub
    

    https://msdn.microsoft.com/en-us/library/windows/desktop/bb774085(v=vs.85).aspx

提交回复
热议问题