Solved

Calling Excel functions from Access

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

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

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

Suggested Solutions

AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
The Windows Phone Theme Colours is a tight, powerful, and well balanced palette. This tiny Access application makes it a snap to select and pick a value. And it doubles as an intro to implementing WithEvents, one of Access' hidden gems.
The view will learn how to download and install SIMTOOLS and FORMLIST into Excel, how to use SIMTOOLS to generate a Monte Carlo simulation of 30 sales calls, and how to calculate the conditional probability based on the results of the Monte Carlo …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

739 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