Solved

Calling Excel functions from Access

Posted on 2011-09-30
2
226 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

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Outlook Free & Paid Tools
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

758 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

18 Experts available now in Live!

Get 1:1 Help Now