精华内容
下载资源
问答
  • vba打包

    千次阅读 2016-05-12 17:07:49
    我的vba封装学习过程 http://club.excelhome.net/thread-1160458-1-1.html (出处: ExcelHome技术论坛)
    我的vba封装学习过程
    
    http://club.excelhome.net/thread-1160458-1-1.html
    (出处: ExcelHome技术论坛)
    展开全文
  • vba开发源码实例打包(excel文件)。
  • 该工具可以将excel vba编写的程序 转换为可执行文件, 软件于2006-11-1进行了更新: 1).改进了超链失效的BUG.. 2).启动界面取消了置顶
  • 仓库打包需要每个订单所用的包装材料,用这个表格可以轻松收集。
  • excel vba 封装到exe

    热门讨论 2011-06-23 10:16:08
    excel vba 封装到exe 绿色安装软件
  • 将Excel VBA封装成exe程序

    万次阅读 2019-04-19 05:54:20
  • 目的: 用VBA做的窗体和音乐,图片资源能打包可执行文件吗?比如EXE 现在没有找到很合适的方法 网上说法一般都是要VB6,我也没装过VB,也不想那个。。。有那时间不如学python去,尴尬 VBA是因为和EXCEL绑在一起...

    目的: 用VBA做的窗体和音乐,图片资源能打包可执行文件吗?比如EXE

     

    • 现在没有找到很合适的方法
    • 网上说法一般都是要VB6,我也没装过VB,也不想那个。。。有那时间不如学python去,尴尬
    • VBA是因为和EXCEL绑在一起了

     

    1 暂时比较凑合的方法:让用户打开EXCEL马上显示窗体。

    • EXCEL的open事件
    • 直接显示窗体,并且隐藏application
    • 资源应该放在一个文件夹下
    • 且资源引用应该用总绝对路径+相对路径的方式
    Private Sub Workbook_Open()
    Load music
    'Application.DisplayAlerts = False
    Application.Visible = False
    music.Show vbModeless
    End Sub
    • 窗体关闭前,再打开EXCEL
    Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
    Application.Visible = True
    End Sub

     

     

    2 其他方法  VB6

    http://club.excelhome.net/forum.php?mod=viewthread&tid=912591

    https://blog.csdn.net/miaozk2006/article/details/82417176

     

    3  其他方法

    还没看懂的。。

    http://club.excelhome.net/forum.php?mod=viewthread&tid=1334673

    https://bbs.csdn.net/topics/391976688

     

     

    4 我这个代码,因为带一个 mediaplayer 所有会弹出 msforms 警告,如果想关闭也比较麻烦

    参考:http://club.excelhome.net/thread-474562-1-1.html

     

     

    展开全文
  • vba 压缩文件 使用方便 (Ease of use) There are many uses for zip folders. Previously, saving disk space was the primary purpose, but today that often isn't very important; more the option for ...

    vba 压缩文件

    使用方便 (Ease of use)

    There are many uses for zip folders. Previously, saving disk space was the primary purpose, but today that often isn't very important; more the option for collecting a selection of files in one file may be more pertinent.

    zip文件夹有很多用途。 以前,节省磁盘空间是主要目的,但如今,这通常并不是很重要。 此外,在一个文件中收集选择的文件的选项可能更相关。

    However, for whatever reason or purpose you may have for using a zip folder (or a file as it physically is) that is controlled by VBA code in, say, Microsoft Excel or Microsoft Access, it should be easy to manage. 

    但是,无论出于何种原因或目的,使用在Microsoft Excel或Microsoft Access中由VBA代码控制的zip文件夹(或实际上是文件的文件),都应该易于管理。

    Several external third-party tools and libraries are offered, and each may have certain advantages, but for the general usage - reading and writing zip folders as Windows Explorer does - you only need the two functions presented here: Zip and Unzip - nothing more, nothing less.

    提供了几种外部第三方工具和库,每种工具都有某些优点,但是对于一般用途-像Windows资源管理器一样读写zip文件夹-您仅需要此处提供的两个功能: ZipUnzip-仅此而已,不外乎。

    Note: Cabinet  files/folders can be managed in similar ways. If you are interested in this, please see:
    Handle cabinet files and folders with VBA the Windows Explorer way

    注意: 内阁文件/文件夹可以用类似的方式进行管理。 如果您对此感兴趣,请参阅:
    使用Windows资源管理器方式使用VBA处理文件柜文件和文件夹


    (
    )

    压缩和解压缩 (Zip and Unzip)

    These two functions are included in the code and does just that in a way that - by default - matches the result as if you did it manually onscreen using Windows Explorer. 

    这两个函数包含在代码中,并且以与默认情况下匹配结果的方式(就像您使用Windows资源管理器在屏幕上手动完成)那样进行操作。

    They can do a little more, controlled by the parameters as explained below, and will also work with custom file extensions, should you have the need. Thus, a zip folder may be named, say, myzipfolder.baz . This will prevent the file from being recognized by Windows Explorer as a zip folder.

    它们可以通过如下所述的参数控制来做更多的工作,并且如果需要,还可以使用自定义文件扩展名。 因此,一个zip文件夹可以命名为myzipfolder.baz 。 这将防止Windows资源管理器将该文件识别为zip文件夹。

    For large and/or many files, the well-known progress bar box will be displayed.

    对于大文件和/或许多文件,将显示众所周知的进度栏框。

    压缩 (Zip)

    Result = Zip(Path) 
    

    This zips Path  (a file or a folder) as if you, in Windows Explorer, right-click the file/folder and select Send to zip compressed folder. Result holds 0 (zero) if success, or an error code.

    就像在Windows资源管理器中一样,右键单击文件/文件夹,然后选择发送到zip压缩文件夹,这样就可以压缩 Path (文件或文件夹)的路径 。 如果成功,则结果为0(零),否则为错误代码。

    For many practical purposes, you also wish to specify where  the zip folder will be created and/or what name it should be given. Thus:

    出于许多实际目的,您还希望指定将在何处创建zip文件夹和/或应为其指定名称。 从而:

    Destination = "D:\Backups\Data_20171224.zip"
    Result = Zip(Path, Destination) 
    

    Should you wish so, the extension can be different from zip, for example:

    如果需要,扩展名可以与zip不同,例如:

    Destination = "D:\Backups\Data_20171224.zap" 
    

    Also you are probably aware, that if you, in Windows Explorer, tries to zip a file/folder once more, Windows Explorer will generate a "versioned" zip file, like:

    您可能还知道,如果您在Windows资源管理器中尝试再次压缩文件/文件夹,则Windows资源管理器将生成一个“版本化”的zip文件,例如:

    D:\Backups\Data_20171224.zip
    D:\Backups\Data_20171224 (2).zip
    D:\Backups\Data_20171224 (3).zip 
    

    and so on - and so will Zip do. 

    等等-Zip也会这样做。

    If you don't want this, a third parameter is available, Overwrite. Thus, if the destination exists:

    如果您不希望这样做,则可以使用第三个参数“覆盖”。 因此,如果目的地存在:

    Result = Zip(Path, , True)     ' Delete and recreate the zip folder.
    Result = Zip(Path, , False)    ' Create a versioned zip folder. 
    


    (
    )

    解压缩 (UnZip)

    Result = UnZip(Path) 
    

    This unzips Path  (a zip folder) as if you, in Windows Explorer, right-click the zip folder and select Unzip all.... Result holds 0 (zero) if success, or an error code.

    就像在Windows资源管理器中右键单击zip文件夹并选择全部解压缩...一样,这会将Path (一个zip文件夹) 解压缩 。 如果成功,则结果为0(零),否则为错误代码。

    Often, you wish to specify where  the zip folder will be unzipped and/or what name the folder should be given. If so, specify the Destination parameter:

    通常情况下,你想指定的zip文件夹将被解压缩和/或什么名字的文件夹应该放在首位。 如果是这样,请指定Destination参数:

    Destination = "D:\Restore\Data"
    Result = UnZip(Path, Destination) 
    

    By default, if unzipping to an existing folder, UnZip will leave existing other files, but overwrite those named as the files in the zip folder. Setting parameter Overwrite to True, will overwrite the existing folder completely:

    默认情况下,如果解压缩到现有文件夹,则UnZip将保留现有的其他文件,但会覆盖zip文件夹中命名为文件的那些文件。 将参数Overwrite设置为True,将完全覆盖现有文件夹:

    Result = UnZip(Path, , True)     ' Delete and recreate the folder.
    Result = UnZip(Path, , False)    ' Leave existing files in the folder. 
    

    Warning

    警告

    Be careful and double-check before calling UnZip with Overwrite set to True.

    在调用Overwrite设置为True的 UnZip之前, 请小心并仔细检查

    If Destination is specified incorrectly, you may inadvertently erase most of a drive.

    如果目的地指定不正确,则可能会无意中擦除大多数驱动器

    (Code)

    Both Zip and UnZip takes advantage of two standard Microsoft libraries found on any Windows machine:

    Zip和UnZip都利用在任何Windows机器上都能找到的两个标准Microsoft库:

         Microsoft Shell Controls And Automation

    Microsoft Shell控件和自动化

         Microsoft Scripting Runtime

    Microsoft脚本运行时

    and both functions allow for early  or late binding  as you prefer, controlled by the constant EarlyBinding that you can adjust to your preference.

    并且这两个功能都可以根据您的喜好进行早期晚期绑定 ,并由您可以根据自己的喜好调整的常量EarlyBinding控制。

    There are many more details to take care of than one might expect, thus a lot of comments are outlined here to study for those that are interested. But don't feel obliged; the functions are ready to use as is.

    有更多细节需要照顾,可能比人们期望的要多,因此这里概述了许多评论,供有兴趣的人学习。 但是不要觉得有义务。 这些函数可以按原样使用。

    压缩 (Zip)

    This is the full function:

    这是全部功能:

    ' Zip a file or a folder to a zip file/folder using Windows Explorer.
    ' Default behaviour is similar to right-clicking a file/folder and selecting:
    '   Send to zip file.
    '
    ' Parameters:
    '   Path:
    '       Valid (UNC) path to the file or folder to zip.
    '   Destination:
    '       (Optional) Valid (UNC) path to file with zip extension or other extension.
    '   Overwrite:
    '       (Optional) Leave (default) or overwrite an existing zip file.
    '       If False, the created zip file will be versioned: Example.zip, Example (2).zip, etc.
    '       If True, an existing zip file will first be deleted, then recreated.
    '
    '   Path and Destination can be relative paths. If so, the current path is used.
    '
    '   If success, 0 is returned, and Destination holds the full path of the created zip file.
    '   If error, error code is returned, and Destination will be zero length string.
    '
    ' Early binding requires references to:
    '
    '   Shell:
    '       Microsoft Shell Controls And Automation
    '
    '   Scripting.FileSystemObject:
    '       Microsoft Scripting Runtime
    '
    ' 2017-10-22. Gustav Brock. Cactus Data ApS, CPH.
    '
    Public Function Zip( _
        ByVal Path As String, _
        Optional ByRef Destination As String, _
        Optional ByVal Overwrite As Boolean) _
        As Long
       
    #If EarlyBinding Then
        ' Microsoft Scripting Runtime.
        Dim FileSystemObject    As Scripting.FileSystemObject
        ' Microsoft Shell Controls And Automation.
        Dim ShellApplication    As Shell
       
        Set FileSystemObject = New Scripting.FileSystemObject
        Set ShellApplication = New Shell
    #Else
        Dim FileSystemObject    As Object
        Dim ShellApplication    As Object
        Set FileSystemObject = CreateObject("Scripting.FileSystemObject")
        Set ShellApplication = CreateObject("Shell.Application")
    #End If
       
        ' Mandatory extension of zip file.
        Const ZipExtensionName  As String = "zip"
        Const ZipExtension      As String = "." & ZipExtensionName
        ' Custom error values.
        Const ErrorPathFile     As Long = 75
        Const ErrorOther        As Long = -1
        Const ErrorNone         As Long = 0
        ' Maximum (arbitrary) allowed count of created zip versions.
        Const MaxZipVersion     As Integer = 1000
       
        Dim ZipHeader           As String
        Dim ZipPath             As String
        Dim ZipName             As String
        Dim ZipFile             As String
        Dim ZipBase             As String
        Dim ZipTemp             As String
        Dim Version             As Integer
        Dim Result              As Long
       
        If FileSystemObject.FileExists(Path) Then
            ' The source is an existing file.
            ZipName = FileSystemObject.GetBaseName(Path) & ZipExtension
            ZipPath = FileSystemObject.GetFile(Path).ParentFolder
        ElseIf FileSystemObject.FolderExists(Path) Then
            ' The source is an existing folder.
            ZipName = FileSystemObject.GetBaseName(Path) & ZipExtension
            ZipPath = FileSystemObject.GetFolder(Path).ParentFolder
        Else
            ' The source does not exist.
        End If
           
        If ZipName = "" Then
            ' Nothing to zip. Exit.
            Destination = ""
        Else
            If Destination <> "" Then
                If FileSystemObject.GetExtensionName(Destination) = "" Then
                    ' Destination is a folder.
                    ZipPath = Destination
                Else
                    ' Destination is a file.
                    ZipName = FileSystemObject.GetFileName(Destination)
                    ZipPath = FileSystemObject.GetParentFolderName(Destination)
                End If
            Else
                ' Use the already found folder of the source.
            End If
            ZipFile = FileSystemObject.BuildPath(ZipPath, ZipName)
            If FileSystemObject.FileExists(ZipFile) Then
                If Overwrite = True Then
                    ' Delete an existing file.
                    FileSystemObject.DeleteFile ZipFile, True
                    ' At this point either the file is deleted or an error is raised.
                Else
                    ZipBase = FileSystemObject.GetBaseName(ZipFile)
                    ' Modify name of the zip file to be created to preserve an existing file:
                    '   "Example.zip" -> "Example (2).zip", etc.
                    Version = Version + 1
                    Do
                        Version = Version + 1
                        ZipFile = FileSystemObject.BuildPath(ZipPath, ZipBase & Format(Version, " \(0\)") & ZipExtension)
                    Loop Until FileSystemObject.FileExists(ZipFile) = False Or Version > MaxZipVersion
                    If Version > MaxZipVersion Then
                        ' Give up.
                        Err.Raise ErrorPathFile, "Zip Create", "File could not be created."
                    End If
                End If
            End If
       
            ' Create a temporary zip name to allow for a final destination file with another extension than zip.
            ZipTemp = FileSystemObject.BuildPath(ZipPath, FileSystemObject.GetBaseName(FileSystemObject.GetTempName()) & ZipExtension)
            ' Create empty zip folder.
            ' Header string provided by Stuart McLachlan <stuart@lexacorp.com.pg>.
            ZipHeader = Chr(80) & Chr(75) & Chr(5) & Chr(6) & String(18, vbNullChar)
            With FileSystemObject.OpenTextFile(ZipTemp, ForWriting, True)
                .Write ZipHeader
                .Close
            End With
           
            ' Resolve relative paths.
            ZipTemp = FileSystemObject.GetAbsolutePathName(ZipTemp)
            Path = FileSystemObject.GetAbsolutePathName(Path)
            ' Copy the source file/folder into the zip file.
            With ShellApplication
                Debug.Print Timer, "Zipping started . ";
                .Namespace(CVar(ZipTemp)).CopyHere CVar(Path)
                ' Ignore error while looking up the zipped file before is has been added.
                On Error Resume Next
                ' Wait for the file to created.
                Do Until .Namespace(CVar(ZipTemp)).Items.Count = 1
                    ' Wait a little ...
                    Sleep 50
                    Debug.Print ".";
                Loop
                Debug.Print
                ' Resume normal error handling.
                On Error GoTo 0
                Debug.Print Timer, "Zipping finished."
            End With
            ' Rename the temporary zip to its final name.
            FileSystemObject.MoveFile ZipTemp, ZipFile
        End If
       
        Set ShellApplication = Nothing
        Set FileSystemObject = Nothing
       
        If Err.Number <> ErrorNone Then
            Destination = ""
            Result = Err.Number
        ElseIf Destination = "" Then
            Result = ErrorOther
        End If
       
        Zip = Result
    End Function 
    

    It is heavily commented in-line, but the key points are:

    它在网上被大量评论,但关键点是:

    1. Verifies the source

      验证来源
    2. Verifies the destination

      验证目的地
    3. Copies the files

      复制文件
    4. Performs clean-up

      执行清理

    The core code is this (shortened) which copies the file(s) into the zip folder:

    核心代码是此代码(缩短的),它将文件复制到zip文件夹中:

            With ShellApplication
                .Namespace(CVar(ZipTemp)).CopyHere CVar(Path)
            End With 
    

    A problem here is, however, that after calling this, our code would just continue, while - as you know - zipping a lot of files can take some time, and we have some clean-up to do afterwards.

    但是,这里的问题是,调用此代码后,我们的代码将继续执行,而-如您所知-压缩许多文件可能需要一些时间,并且此后需要做一些清理工作。

    Thus, it is necessary to put in a loop that regularly checks if the zip folder is ready and, only when it is, to continue.

    因此,有必要放入一个循环,该循环定期检查zip文件夹是否已准备就绪,只有在准备就绪时才能继续。

    This is shown here, where the Sleep function in the Do Until ... Loop  inserts a tiny delay which will be repeated over and over until the zip folder is ready:

    如此处所示,在“直到...”循环中的“睡眠”功能会插入一个微小的延迟,该延迟会一遍又一遍地重复直到zip文件夹准备就绪:

            With ShellApplication
                Debug.Print Timer, "Zipping started . ";
                .Namespace(CVar(ZipTemp)).CopyHere CVar(Path)
                ' Ignore error while looking up the zipped file before is has been added.
                On Error Resume Next
                ' Wait for the file to created.
                Do Until .Namespace(CVar(ZipTemp)).Items.Count = 1
                    ' Wait a little ...
                    Sleep 50
                    Debug.Print ".";
                Loop
                Debug.Print
                ' Resume normal error handling.
                On Error GoTo 0
                Debug.Print Timer, "Zipping finished."
            End With 
    

    In case parameter Overwrite  is False and the zip folder exists, a new file will be created and given a version number.

    如果参数Overwrite为False且zip文件夹存在,则将创建一个新文件并指定版本号。

    That is controlled by this loop:

    这由以下循环控制:

    ZipBase = FileSystemObject.GetBaseName(ZipFile)
    ' Modify name of the zip file to be created to preserve an existing file:
    '   "Example.zip" -> "Example (2).zip", etc.
    Version = Version + 1
    Do
        Version = Version + 1
        ZipFile = FileSystemObject.BuildPath(ZipPath, ZipBase & Format(Version, " \(0\)") & ZipExtension)
    Loop Until FileSystemObject.FileExists(ZipFile) = False Or Version > MaxZipVersion
    If Version > MaxZipVersion Then
        ' Give up.
        Err.Raise ErrorPathFile, "Zip Create", "File could not be created."
    End If 
    

    As you will see, a maximum count is used to prevent the loop from going on forever.

    正如您将看到的,最大计数用于防止循环永远持续下去。

    UnZip

    解压缩

    This is the full function:

    这是全部功能:

    ' Unzip files from a zip file to a folder using Windows Explorer.
    ' Default behaviour is similar to right-clicking a file/folder and selecting:
    '   Unzip all ...
    '
    ' Parameters:
    '   Path:
    '       Valid (UNC) path to a valid zip file. Extension can be another than "zip".
    '   Destination:
    '       (Optional) Valid (UNC) path to the destination folder.
    '   Overwrite:
    '       (Optional) Leave (default) or overwrite an existing folder.
    '       If False, an existing folder will keep other files than those in the extracted zip file.
    '       If True, an existing folder will first be deleted, then recreated.
    '
    '   Path and Destination can be relative paths. If so, the current path is used.
    '
    '   If success, 0 is returned, and Destination holds the full path of the created folder.
    '   If error, error code is returned, and Destination will be zero length string.
    '
    ' Early binding requires references to:
    '
    '   Shell:
    '       Microsoft Shell Controls And Automation
    '
    '   Scripting.FileSystemObject:
    '       Microsoft Scripting Runtime
    '
    ' 2017-10-22. Gustav Brock. Cactus Data ApS, CPH.
    '
    Public Function UnZip( _
        ByVal Path As String, _
        Optional ByRef Destination As String, _
        Optional ByVal Overwrite As Boolean) _
        As Long
       
    #If EarlyBinding Then
        ' Microsoft Scripting Runtime.
        Dim FileSystemObject    As Scripting.FileSystemObject
        ' Microsoft Shell Controls And Automation.
        Dim ShellApplication    As Shell
       
        Set FileSystemObject = New Scripting.FileSystemObject
        Set ShellApplication = New Shell
    #Else
        Dim FileSystemObject    As Object
        Dim ShellApplication    As Object
        Set FileSystemObject = CreateObject("Scripting.FileSystemObject")
        Set ShellApplication = CreateObject("Shell.Application")
    #End If
                   
        ' Extension of a cabinet file holding one or more files.
        Const CabExtensionName  As String = "cab"
        ' Mandatory extension of zip file.
        Const ZipExtensionName  As String = "zip"
        Const ZipExtension      As String = "." & ZipExtensionName
        ' Constants for Shell.Application.
        Const OverWriteAll      As Long = &H10&
        ' Custom error values.
        Const ErrorNone         As Long = 0
        Const ErrorOther        As Long = -1
       
        Dim ZipName             As String
        Dim ZipPath             As String
        Dim ZipTemp             As String
        Dim Result              As Long
       
        If FileSystemObject.FileExists(Path) Then
            ' The source is an existing file.
            ZipName = FileSystemObject.GetBaseName(Path)
            ZipPath = FileSystemObject.GetFile(Path).ParentFolder
        End If
       
        If ZipName = "" Then
            ' Nothing to unzip. Exit.
            Destination = ""
        Else
            ' Select or create destination folder.
            If Destination <> "" Then
                ' Unzip to a custom folder.
                If _
                    FileSystemObject.GetExtensionName(Destination) = CabExtensionName Or _
                    FileSystemObject.GetExtensionName(Destination) = ZipExtensionName Then
                    ' Do not unzip to a folder named *.cab or *.zip.
                    ' Strip extension.
                    Destination = FileSystemObject.BuildPath( _
                        FileSystemObject.GetParentFolderName(Destination), _
                        FileSystemObject.GetBaseName(Destination))
                End If
            Else
                ' Unzip to a subfolder of the folder of the zipfile.
                Destination = FileSystemObject.BuildPath(ZipPath, ZipName)
            End If
               
            If FileSystemObject.FolderExists(Destination) And Overwrite = True Then
                ' Delete the existing folder.
                FileSystemObject.DeleteFolder Destination, True
            End If
            If Not FileSystemObject.FolderExists(Destination) Then
                ' Create the destination folder.
                FileSystemObject.CreateFolder Destination
            End If
           
            If Not FileSystemObject.FolderExists(Destination) Then
                ' For some reason the destination folder does not exist and cannot be created.
                ' Exit.
                Destination = ""
            Else
                ' Destination folder existed or has been created successfully.
                ' Resolve relative paths.
                Destination = FileSystemObject.GetAbsolutePathName(Destination)
                Path = FileSystemObject.GetAbsolutePathName(Path)
                ' Check file extension.
                If FileSystemObject.GetExtensionName(Path) = ZipExtensionName Then
                    ' File extension is OK.
                    ZipTemp = Path
                Else
                    ' Rename the zip file by adding a zip extension.
                    ZipTemp = Path & ZipExtension
                    FileSystemObject.MoveFile Path, ZipTemp
                End If
                ' Unzip files and folders from the zip file to the destination folder.
                ShellApplication.Namespace(CVar(Destination)).CopyHere ShellApplication.Namespace(CVar(ZipTemp)).Items, OverWriteAll
                If ZipTemp <> Path Then
                    ' Remove the zip extension to restore the original file name.
                    FileSystemObject.MoveFile ZipTemp, Path
                End If
            End If
        End If
       
        Set ShellApplication = Nothing
        Set FileSystemObject = Nothing
       
        If Err.Number <> ErrorNone Then
            Destination = ""
            Result = Err.Number
        ElseIf Destination = "" Then
            Result = ErrorOther
        End If
       
        UnZip = Result
         
    End Function 
    

    Again, the in-line comments should make it possible to follow its doings, but in essence it performs these steps:

    再次,在线注释应该使得可以遵循其操作,但是从本质上讲,它执行以下步骤:

    1. Verifies the source

      验证来源
    2. Verifies the destination

      验证目的地
    3. Copies the files

      复制文件
    4. Performs clean-up

      执行清理

    Again, the core code is quite simple; it copies the content of the source - the zip folder - into the destination folder:

    同样,核心代码非常简单; 它将源内容(zip文件夹)复制到目标文件夹:

        ShellApplication.Namespace(CVar(Destination)).CopyHere ShellApplication.Namespace(CVar(ZipTemp)).Items, OverWriteAll
    
     
    

    Contrary to the copying to a zip folder (above), this code waits for the copying to finish, and will not continue until copying is done.

    与复制到zip文件夹(上面)相反,此代码等待复制完成,并且直到复制完成后才继续。

    结论 (Conclusion)

    Armed with these two functions, you can control all basic zipping and unzipping from VBA. No external tools or libraries are used, which makes distributing and deployment easy. 

    有了这两个功能,您就可以控制VBA的所有基本压缩和解压缩。 没有使用外部工具或库,这使得分发和部署变得容易。

    Of course, more advanced options, like encrypting, may be requested, and then third-party tools like WinZip  or 7Zip  must be used. But this will be more about zip files  while we here discuss zip folders  as we know them from Windows.

    当然,可能需要更高级的选项,例如加密,然后必须使用WinZip7Zip等第三方工具。 但这将更多地与zip 文件有关,而我们在这里讨论zip 文件夹时,就像我们在Windows中所知道的那样。


    (
    )

    文件和下载 (Files and download)

    The complete module and an Access 2106 file is here: Compress 1.1.1.zip

    完整的模块和Access 2106文件在此处: Compress 1.1.1.zip

    It will run in both 32- and 64-bit VBA.

    它将在32位和64位VBA中运行。

    Current files can always be found at: GitHub VBA.Compress

    当前文件始终可以在以下网址找到: GitHub VBA.Compress

    I hope you found this article useful. You are encouraged to ask questions, report any bugs or make any other comments about it below.

    希望本文对您有所帮助。 鼓励您在下面提出问题,报告任何错误或对此作出任何其他评论。

    Note: If you need further "Support" about this topic, please consider using the Ask a Question feature of Experts Exchange. I monitor questions asked and would be pleased to provide any additional support required in questions asked in this manner, along with other EE experts.

    注意 :如果您需要有关此主题的更多“支持”,请考虑使用Experts Exchange 的“提问”功能。 我会监督提出的问题,并很高兴与其他电子工程师一起为以这种方式提出的问题提供所需的任何其他支持。

    Please do not forget to press the "Thumbs Up" button if you think this article was helpful and valuable for EE members.

    如果您认为本文对EE成员有用且有价值,请不要忘记按下“竖起大拇指”按钮。

    翻译自: https://www.experts-exchange.com/articles/31130/Zip-and-unzip-files-and-folders-with-VBA-the-Windows-Explorer-way.html

    vba 压缩文件

    展开全文
  • 将Excel VBA封装成exe程序[老贴收藏]

    万次阅读 2019-09-17 16:23:22
    将Excel VBA封装成exe程序[老贴收藏] 假如您手头已有一xls文档等待封装,假如您机子上已安装有VB6开发系统,那么请跟着往下操作: 一、用VB制作EXE文件头部分 1、打开VB,“文件”-“新建工程”-“标准EXE”; 2...
  • vue打包成exe(详细)

    2021-08-07 00:36:10
    -overwrite" 第九:运行命令打包,然后项目中会出现一个 App-win32-x64 的文件夹,这个文件就是打包好的桌面应用,文件夹里有一个 App.exe 文件,App.exe就是这个项目的启动文件: npm run packager 不是一个EXE文件...
  • 内含 Visual Basic 6 开发参考、VBScript语言参考、700多个VB API函数的详细介绍、VB指针的使用共 4 个文档,是学习 VB/VBA 语言的绝佳参考资料,随用随翻,使用非常方便。
  • vue项目打包exe文件

    千次阅读 2020-11-28 11:18:31
    方案一:利用electron直接打包项目 暂未成功,打包完exe会报错 打包方式: (1)DOS窗口命令打包 DOS 下,输入 npm install electron-packager -g全局安装我们的打包神器: cnpm install electron-packager -g (2...
  • Word VBA中制作了一个窗体向Word中添加文字,这个窗体能生成EXE文件吗,怎么操作呢?
  • Sub 报表打包() On Error Resume Next Dim a As String a = "C:\Users\Administrator\Desktop\201605报表\tempfolder" If Len(Dir(a)) = Empty Then Set tempfolder = CreateObject("scripting.filesystemobject...
  • VB封装Excel_VBA代码为Dll

    千次阅读 2017-03-16 10:59:14
    VB封装Excel_VBA代码为Dll VB封装Excel_VBA代码为Dll VB封装Excel_VBA成DLL技巧 使用VB6.0在WinXP_sp2、Excel 2000环境下制作、测试通过一、启动VB6.0 VB封装Excel_VBA成DLL技巧 使用VB6.0在WinXP_sp2、Excel ...
  • VBA操作封装为DLL组件并在EXCEL中调用

    万次阅读 多人点赞 2015-03-14 17:12:49
    使用程序: 1、Microsoft Office Excel 2003 2、Microsoft Visual Basic 6.0 案例:在工作表的C1单元格得出A1单元格+B1...设计的VBA代码: Sub Test()  On Error Resume Next  Range("C1") = Cells(1, 1) +
  • 大家在学习VBA的过程中,相信都有收集代码的习惯,我也是,硬盘中藏有许多VBA实例、代码,在去年《VBA精粹》的写作过程中更是在网络上收集了大量的VBA资料。这些散布在各处的代码、实例对学习的帮助很大,但是查找...
  • Dim site As String Dim FolderName As String Dim FolderName1 As String Dim Rarexe As String Dim Source As String Dim Target As String Dim FileString As...
  • 根据佛山老鼠说VBA 自制的Excel插件,可以参考一下,请多多指教
  • VBA类模块封装

    2021-02-10 09:35:09
    VBA类模块封装2018-09-26"封装宏-------------------------Sub 表达式变公式()Dim g As New 功能库g.公式变数值 Range("b3")g.自定义格式变数值 Range("c3")g.表达式变公式 Range("d3")End SubSub 删除重复值()Dim ...
  • 我只是简单地调整了我需要的东西,然后将它们全部打包到一个实用程序中。 与大多数翻译工具一样,此工具不会执行100%完整的翻译。 它旨在涵盖VBA中的常见构造(足以帮助您入门)。 这个想法是输入VBA代码的基本...
  • Access VBA活用范例大辞典范例源文件,原光盘拷坝打包提供下载。
  • VBA代码封装完整示例.rarVBA代码封装完整示例.rarVBA代码封装完整示例.rar
  • vsto安装包打包模板.iss、下载个Inno Setup 编译器直接允许该文件即可,只需改几个名字改为自己的安装包名称即可
  • Office 2013 Language Reference VBA , 全部套件开发手册打包,英文版本。
  • 本课程是SPSS统计自动化和扩展编程系列视频课程中的一个,主要介绍用SPSS提供的VBA语言WinWrap?...具体内容请参见目录。课程不设期限,永久有效。会持续升级。...购买系列课程提供打包价,购买讲师卡更划算。
  • VBA 操作SAP

    千次阅读 多人点赞 2019-04-24 14:36:17
    为后期自动化做准备,找了很多资料,尝试了不少语言,最后选择了VBA。 在我看来SAP是一个数据库管理系统,记得20年前刚解除计算机,曾学了一点foxbase,做过一个图书馆管理系统。当然SAP很复杂,因为SAP本身有自己...
  • vba导入数据库数据

    2021-01-19 18:13:41
    静态库是一个或者多个obj文件的打包,所以有人干脆把从obj文件生成lib的过程称为Arch... 文章 double2li 2012-10-29 764浏览量 动态链接库dll,静态链接库lib, 导入库lib 转载地址:...
  • VBA常用技巧解析(全卷).zip

    热门讨论 2014-06-26 17:29:10
    一共4卷,我花了16分一个一个下载,然后打包在一起了。

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 1,329
精华内容 531
关键字:

vba打包