Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi All --
What is the one line of code that will enter a password upon opening a workbook (assuming macros are enabled)? Thanks. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
this should do it
ActiveWorkbook.Unprotect (your password) -----Original Message----- Hi All -- What is the one line of code that will enter a password upon opening a workbook (assuming macros are enabled)? Thanks. . |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hello Experts,
I have the same question...Opening a workbook that's needs a password first in order to open it. But this code still doesn't work. Any ideas? Workbooks.Open Filename:="C:\My Documents\File1.xls" ActiveWorkbook.Unprotect "test" I've tried no quotations, brackets, no brackets, around the password but of no avail. The popup for the password still surfaces. And, I do have the correct password. I've even tried: Dim Password as variant Password = "test" Workbooks.Open Filename:="C:\My Documents\File1.xls" ActiveWorkbook.Unprotect Password It still prompts me to enter the password manually to open the file. Any ideas? Thanks in advance, Ricky *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ricky,
Dim wkbk as string, pass as string wkbk = "?????" ' include path pass = "mypassword" Workbooks.Open FileName:=wkbk, password:=pass -- sb "Ricky Pang" wrote in message ... Hello Experts, I have the same question...Opening a workbook that's needs a password first in order to open it. But this code still doesn't work. Any ideas? Workbooks.Open Filename:="C:\My Documents\File1.xls" ActiveWorkbook.Unprotect "test" I've tried no quotations, brackets, no brackets, around the password but of no avail. The popup for the password still surfaces. And, I do have the correct password. I've even tried: Dim Password as variant Password = "test" Workbooks.Open Filename:="C:\My Documents\File1.xls" ActiveWorkbook.Unprotect Password It still prompts me to enter the password manually to open the file. Any ideas? Thanks in advance, Ricky *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Steve,
Thanks! That's the ticket. I used this one-liner: Workbooks.Open Filename:="C:\My Documents\File1.xls", Password:="test" Just wondering, what's the difference between this one-liner and Dimensioning other than setting the filename path and password up front so that it can be recalled at a later point in the code, if needed? Dim wkbk as string, pass as string wkbk = "?????" ' include path pass = "mypassword" Thanks again, Ricky *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Ricky,
You got it. Also in my application I am opening multiple workbooks and need to set the password for each. So that pass = a reference to a list and changes in a loop. Glad it worked for you... -- sb "Ricky Pang" wrote in message ... Hi Steve, Thanks! That's the ticket. I used this one-liner: Workbooks.Open Filename:="C:\My Documents\File1.xls", Password:="test" Just wondering, what's the difference between this one-liner and Dimensioning other than setting the filename path and password up front so that it can be recalled at a later point in the code, if needed? Dim wkbk as string, pass as string wkbk = "?????" ' include path pass = "mypassword" Thanks again, Ricky *** Sent via Developersdex http://www.developersdex.com *** Don't just participate in USENET...get rewarded for it! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel macro to open a password protected workbook | Excel Discussion (Misc queries) | |||
Password to enter the sheet | Excel Worksheet Functions | |||
Open a workbook with a password via macro - How to? | Excel Discussion (Misc queries) | |||
Macro to select cells in column enter data then press enter | New Users to Excel | |||
How to see macro code of a password protected macro without a password? | Excel Worksheet Functions |