Solved

Unprotect Excel File from Access

Posted on 2011-09-30
3
293 Views
Last Modified: 2012-06-21
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?
0
Comment
Question by:fitaliano
  • 2
3 Comments
 
LVL 18

Accepted Solution

by:
Richard Daneke earned 500 total points
ID: 36893989
I have good news and bad news.
The good news is that no password is needed with the DoCmd. TransferSpreadSheet
The bad news is that your password is preventing the computer from replacing your existing file.  So, you must leave the workbook unprotected.
If security is an issue, place the file in a folder with restricted permisssions.  Remember, whoever uses Access to create this exported spreadsheet will need create, read/write access to the folder.
0
 

Author Comment

by:fitaliano
ID: 36894130
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?

0
 
LVL 18

Expert Comment

by:Richard Daneke
ID: 36894976
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.
0

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
What’s inside an Access Desktop Database. Will look at the basic interface, Navigation Pane (Database Container), Tables, Queries, Forms, Report, Macro’s, and VBA code.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question