Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding zip control to Microsoft Excel module

Status
Not open for further replies.

impulse24

IS-IT--Management
Jul 13, 2001
167
US
Hi,

I am using the Xceed Zip Control, and want to add it to a Microsoft Excel VBA module. I have created a module, and added the reference to the Control. Here is the sample Code to reference the control:
General Declarations
Dim WithEvents XceedZip1 As XceedZip

Sub CreateReport()
Set XceedZip1 = New XceedZip


XceedZip1.ZipFilename = "d:\temp\exceed.zip"
XceedZip1.FilesToProcess = "testpower.xls"
XceedZip1.Zip
End Sub

When I try to run the code I get the following error:
Compile Error
Only Valid in Object Module.

Im pretty new to VBA, and am lost as to what to do..Please help. Thanks
 
Use the zip control on the userform instead.

1. Add userform to your project.
2. The Zip Control should be an activex control, so after referencing to the library add control to the toolbox (right-click it, select "Additional controls", find and select the control).
3. Place the control on your UserForm1.
4. Load the userform into memory: [tt]Load UserForm1[/tt]
5. Use the reference: [tt]UserForm1.XceedZip1[/tt]

The user form will exist in the memory, but won't be visible for the user.
 
Remove the 'WithEvents' and your code should work in a module.

If you need to handle the events that the object would raise then you should move your code to an 'Object Module' (for example, a form's code window, or in ThisWorkbook code window, or in a Sheet's code window)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top