Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi,
I have a folder a 5 files (one of them has a password to open it). They are all xlxs and I am working on 2003 with the file convertor installed. I have the following vba workbooks.open(file, false, true, "IncorrectPassword") What I would like to do is if I come to the file with the password not open it and just move on. Instead I keep getting the password open display and I don't want to have to click out of it. Any help much appreciated. Mac |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
dim wkbk as workbook
.... set wkbk = nothing on error resume next set wkbk = workbooks.open(filename:=file, ..., password:="IncorrectPassword") on error goto 0 if wkbk is nothing then 'workbook didn't open else 'do the real work end if === Personally, I find using the keyword parms makes the code much easier to understand. wrote: Hi, I have a folder a 5 files (one of them has a password to open it). They are all xlxs and I am working on 2003 with the file convertor installed. I have the following vba workbooks.open(file, false, true, "IncorrectPassword") What I would like to do is if I come to the file with the password not open it and just move on. Instead I keep getting the password open display and I don't want to have to click out of it. Any help much appreciated. Mac -- Dave Peterson |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On 16 Oct, 14:01, Dave Peterson wrote:
dim wkbk as workbook ... set wkbk = nothing on error resume next set wkbk = workbooks.open(filename:=file, ..., password:="IncorrectPassword") on error goto 0 if wkbk is nothing then * 'workbook didn't open else * 'do the real work end if === Personally, I find using the keyword parms makes the code much easier to understand. wrote: Hi, I have a folder a 5 files (one of them has a password to open it). They are all xlxs and I am working on 2003 with the file convertor installed. I have the following vba workbooks.open(file, false, true, "IncorrectPassword") What I would like to do is if I come to the file with the password not open it and just move on. Instead I keep getting the password open display and I don't want to have to click out of it. Any help much appreciated. Mac -- Dave Peterson- Hide quoted text - - Show quoted text - Hi Dave, Thanks for your quick response. The problem I'm getting is that because I'm in 2003 and the file is xlxs then the password prompt is coming up and I can 't move on without pressing return. Cheers Mac |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Even with the "on error" stuff?
If that's true, then I don't have a suggestion. (I don't use the compatibility pack.) Sorry. wrote: <<snipped Hi Dave, Thanks for your quick response. The problem I'm getting is that because I'm in 2003 and the file is xlxs then the password prompt is coming up and I can 't move on without pressing return. Cheers Mac -- Dave Peterson |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
A shot in the dark, because "On Error.." should cure it, addition to Dave's
code: dim wkbk as workbook ..... Application.DisplayAlerts=False set wkbk = nothing on error resume next set wkbk = workbooks.open(filename:=file, ..., password:="IncorrectPassword") on error goto 0 if wkbk is nothing then 'workbook didn't open else 'do the real work end if Application.DisplayAlerts=True Regards, The Code Cage Team www.thecodecage.com/forumz "Dave Peterson" wrote: Even with the "on error" stuff? If that's true, then I don't have a suggestion. (I don't use the compatibility pack.) Sorry. wrote: <<snipped Hi Dave, Thanks for your quick response. The problem I'm getting is that because I'm in 2003 and the file is xlxs then the password prompt is coming up and I can 't move on without pressing return. Cheers Mac -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
I know my password, yet it will not open my workbook | Excel Worksheet Functions | |||
Open Workbook - Password | Excel Programming | |||
Open workbook with password. | Excel Programming | |||
Open workbook with password in VBA | Excel Programming | |||
Open a password protected excel workbook from second workbook to fetch data using dynamic connection | Excel Programming |