Solved

Calling Excel functions from Access

Posted on 2011-09-30
2
232 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
This article describes how you can use Custom Document Properties to store settings and other information in your workbook so that they will be available the next time you open the workbook.
The viewer will learn how to simulate a series of sales calls dependent on a single skill level and learn how to simulate a series of sales calls dependent on two skill levels. Simulating Independent Sales Calls: Enter .75 into cell C2 – “skill leve…
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.

729 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