Solved

Unprotect Excel File from Access

Posted on 2011-09-30
3
290 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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

In case Office 2010 has not been deployed in your environment, this article may be quite useful. In our office, we wanted a way to deploy Microsoft Office Professional Plus 2010 through an automated batch file via logon script. This article is docum…
I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
The viewer will learn how to simulate a series of coin tosses with the rand() function and learn how to make these “tosses” depend on a predetermined probability. Flipping Coins in Excel: Enter =RAND() into cell A2: Recalculate the random variable…

705 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now