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/Q_24770217.html#a25449768.

Anyone know how to incorporate the VB6 code into a VBA module in Access? Or does anyone have other solutions?
Microsoft AccessMicrosoft OfficeMicrosoft Applications

Avatar of undefined
Last Comment
Jim P.

8/22/2022 - Mon
Jim Dettman (EE MVE)

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.
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 Dettman (EE MVE)

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
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
ASKER CERTIFIED SOLUTION
Jim P.

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
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.
Jim Dettman (EE MVE)

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.
Jim P.

ASKER
Found my own solution.
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.