473,387 Members | 1,899 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

How do you open a protected Excel File from Access and disable protection?

Heather Thurber
I am using the following code in Access 2007 to open an excel spreadsheet when as part of an on click function:

Dim objXLApp As Object
Dim objXLBook As Object
Set objXLApp = CreateObject("Excel.Application")
Set objXLBook = objXLApp.Workbooks.Open("K:\TP_DEV\Development_Hea ther\Payoff_Calculator.xlsm")
objXLApp.Application.Visible = True

objXLBook.ActiveSheet.Range("C9") = Me.curUPB
objXLBook.ActiveSheet.Range("C11") = Me.lngInterest_Rate

I need to know the code to Unprotect this spreadsheet so that I can pass in the data then reactivate protection. There is a password that will be used to unprotect the excel sheet.
Jul 28 '10 #1
4 6630
ADezii
8,834 Expert 8TB
@Heather Thurber
Just subscribing, will return shortly.
Jul 28 '10 #2
ADezii
8,834 Expert 8TB
@Heather Thurber
Try:
Expand|Select|Wrap|Line Numbers
  1. Dim objXLApp As Object
  2. Dim objXLBook As Excel.Workbook
  3.  
  4. Set objXLApp = CreateObject("Excel.Application")
  5. Set objXLBook = objXLApp.Workbooks.Open("K:\TP_DEV\Development_Hea ther\Payoff_Calculator.xlsm")
  6.  
  7. objXLApp.Application.Visible = True
  8.  
  9. With objXLBook
  10.   .Unprotect Password:="Password Here"
  11.     .ActiveSheet.Range("C9") = Me.curUPB
  12.     .ActiveSheet.Range("C11") = Me.lngInterest_Rate
  13.   .Protect Password:="Password Here"     'Protect Workbook again
  14. End With
  15.  
Jul 28 '10 #3
@Heather Thurber
Thanks that worked great!
Jul 28 '10 #4
ADezii
8,834 Expert 8TB
@Heather Thurber
You are quite welcome.
Jul 28 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Dimitris | last post by:
Hi. I want to use the following code in order to open a excel file through my program ( written in C# ). In my pc it is installed the excel 2000. Application excel = new Application(); ...
2
by: Bill nguyen | last post by:
How can I open an Excel file then SAVE AS .CSV file using VB.NET? Thanks Bill
3
by: Johnny | last post by:
Hi, As you know, I can use this to open an Excel file: """ import win32com.client doc = win32com.client.Dispatch("Excel.Application") doc.Workbooks.Open(excelFile, ReadOnly=True) """ But...
1
by: Patrick Barao | last post by:
I'm trying to have a button open an excel file in an Access database based on the record that the focus is on. Does this require special code or is there a macro that does this? If there is no...
3
ammoos
by: ammoos | last post by:
hi friends.. i need to load and open an excel file which is already exist when i click on the link button.. so that the user can updates the details in the excel sheet... help me if u pls......
0
by: radraq | last post by:
Hello, I have just completed a survey in excel which I've uploaded to my website. The propblem is I would like the excel file to open directly online without asking for paswords and save the...
2
by: laurasesma18 | last post by:
Hi, I have a program in Access 2003 and written in Visual Basic. At some point I would like to open an Excel file automatly from Access 2003. So that the user can do some changes in this file...
1
by: mohanprasadgutta | last post by:
Hi, I need help to open a password protected excel file in perl using Win32:OLE. when I tried to open file in normal way at the time of program execution it is prompting me to enter password. I am...
4
by: student491 | last post by:
Hello, i tried to open existNg Excel file by using follow metho bt it give error ... that this file doestnt exist or path is incorrect........ wb =...
2
by: veer | last post by:
Hi i want to open excel file using vb.net . The file is passsword protected and i know the password when i used to open the file with out password it works fine and open but when the file with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.