Xceed Streaming Compression Library Documentation
Compressing from memory to file (VB example)
Examples > Compressing from memory to file (VB example)
Visual Basic Copy Code

Dim xComp As New XceedStreamingCompression

Call xComp.License( "your license key" ) 

Dim vaData As Variant 

Set xComp.CompressionFormat = New XceedBZip2CompressionFormat

vaData = "This is the data to compress compress compress

On Error Resume Next 

Call xComp.WriteFile(vaData, cfpCompress, True, "c:\temp\compressed.cmp", False) 

If Err.Number = 0 Then
  Call MsgBox("Compression successful!") 
Else
  Call MsgBox(Err.Description) 
End If 

Set xComp = Nothing