Link to home
Start Free TrialLog in
Avatar of Jim P.
Jim P.Flag for United States of America

asked on

Extracting CAB files with Access VBA

Previous employees at the company I work at packed a customer data files into a single CAB file, for that companies data. Then the employees had this brilliant idea of using some arcane naming convention, that has no relation to anything that is going on today. My job is now to break the cab files open, read one of the files, and then rename the CAB to something that makes sense, like the customer's name.  There are over a 1K+ of CAB files, so I want to automate it.

I can do all the rest except I'm getting stuck is how to open the CAB file with VBA.

I found reference to this VB6 cab functionality.

That's from  https://www.experts-exchange.com/questions/24770217/VB6-and-Cabinet-dll-how-it-work.html?anchorAnswerId=25449768#a25449768.

Anyone know how to incorporate the VB6 code into a VBA module in Access? Or does anyone have other solutions?
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Jim,

<<Anyone know how to incorporate the VB6 code into a VBA module in Access? Or does anyone have other solutions? >>

 With only a few exceptions, VB code should drop right into VBA and work fine.

Jim.
Avatar of Jim P.

ASKER

If you download and break it open, it doesn't really come with a good explanation of what goes where.

cCDECL.cls
F1.frm
ModFCI.bas
ModFDI.bas
ModFileOps.bas
ModInfo.bas
VBCAB1.vbp
VBCAB1.vbw
VBCAB2 README.txt

Open in new window


I think he was writing it more for the VB6 compile it crowd, not the junior programmer using VBA.
Jim,

OK, I've taken some VB6 I found and have it reading a cab file, getting the number of files in the cab and an XML dump of the files and their attributes.

What kind of output are you looking for?

JimD
ASKER CERTIFIED SOLUTION
Avatar of Jim P.
Jim P.
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jim P.

ASKER

The files in the cab are SQL Server bcp (bulk export) files. I have to grab one of the files, import/read it and then I know what to rename the cab file. I've started autoclose on this.

If you have a better solution, I'd appreciate it. Mine isn't invisible when its doing the extract.
As I said, I have a VBA solution without resorting to the use of the shell.

I found the above as well, but went the VB route.

Jim.
Avatar of Jim P.

ASKER

Found my own solution.