Solved

Calling Excel functions from Access

Posted on 2011-09-30
2
227 Views
Last Modified: 2012-08-13
I am trying to open and unprotect an excel from Access, I have the following code which opens the file but I am not able to unprotect once it is open.  Could you help me to fix it?  It would be fantastic if I could unprotect/protect without opening the file.

    Dim xlAp As Excel.Application
    Dim xlWB As Excel.Workbook
    Set xlApp = New Excel.Application
    With xlApp
         .Visible = True
         Set xlWB = .Workbooks.Open("C:\WFReports_CG.xls", , False)
         Set xlWB = .ThisWorkbook.UnProtect("101112131415161718191a1b1c")
    End With
0
Comment
Question by:fitaliano
2 Comments
 

Author Comment

by:fitaliano
ID: 36894730
I actually found the way to unprotect once open.  Could someone help me with unprotecting without opening the workbook?

    Dim xlAp As Excel.Application
    Dim xlWB As Excel.Workbook
    Set xlApp = New Excel.Application
    With xlApp
         .Visible = True
         Set xlWB = .Workbooks.Open("C:\WFReports_CG.xls", , False)
         .ActiveWorkbook.UnProtect ("101112131415161718191a1b1c")
    End With
0
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 500 total points
ID: 36894805
You cannot unprotect the workbook or individual worksheets unless you first open the workbook.
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

Suggested Solutions

Title # Comments Views Activity
HasData 9 36
Office2007 Training Material Required 2 41
Like Function in Query Dramatically Increasing Run Time 13 32
append to an ms access field 6 21
In this article we discuss how to recover the missing Outlook 2011 for Mac data like Emails and Contacts manually.
A simple tool to export all objects of two Access files as text and compare it with Meld, a free diff tool.
Learn how to create and modify your own paragraph styles in Microsoft Word. This can be helpful when wanting to make consistently referenced styles throughout a document or template.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

911 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

22 Experts available now in Live!

Get 1:1 Help Now