Link to home
Start Free TrialLog in
Avatar of fitaliano
fitalianoFlag for United States of America

asked on

Unprotect Excel File from Access

I have an Access DB that transfers data to an Excel file through the following code:
DoCmd.TransferSpreadsheet acExport, 8, "zLOA_List", "C:\WFReports_CG.xls", True, ""

I have recently protected the workbook and when execute the code above I get "could not decrypt the file"

Is there a way to unprotect the file from Access?
ASKER CERTIFIED SOLUTION
Avatar of Richard Daneke
Richard Daneke
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 fitaliano

ASKER

I was actually thinking of calling Excel objects and unprotect the file from Access.

If I include Microsoft Excel Object Library in my VBE References I could do it, I just don't know how.
The command I want to trigger is:
ActiveWorkbook.Unprotect Password:="blablabla"

How do I specify the workbook to be called?

That would be a great new question.

You can add Excel references to your Access VBA coding.  So, when you have an Active worksheet, you can use
ActiveWorkbook.Unprotect Password:="blablabla"
Yes, this would apply when opening an existing workbook.
The export would use ActiveWorkbook.Protect

Thank you for the grading and accepting my answer.