Vote count:
0
I have been trying to figure out how to zip an Excel .Xlsm file with no luck. The following code creates the zip file, but I can't figure out how to send the .xlsm file to it. Any help is appreciated!
Dim zipPath As String = RegScoringWorkbookName.Replace(".xlsm", ".zip") 'create zip file from .xlsm file
Try
If File.Exists(zipPath) Then
My.Computer.FileSystem.DeleteFile(zipPath, FileIO.UIOption.OnlyErrorDialogs,
FileIO.RecycleOption.DeletePermanently)
End If
Dim FilePath As String = RegScoringWorkbookName 'path of .xlsm file
Using FileStream = New FileStream(zipPath, FileMode.CreateNew)
Using archive = New ZipArchive(FileStream, ZipArchiveMode.Create, True)
Dim zipArchiveEntry = archive.CreateEntry(GetFileName(FilePath), CompressionLevel.Optimal)
Using zipStream = zipArchiveEntry.Open()
' zipStream.WriteAsync()
zipStream.Close()
End Using
End Using
End Using
Catch ex As Exception
End Try
asked 1 min ago
Aucun commentaire:
Enregistrer un commentaire