Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default password in VBA

Hello,

I am trying to understand how macro will write the password in VBAmby using
recording Macro for a protected password workbooks, because I am trying to
make a link base on the example 1 of Mr. Ron De Bruin, but I can not see the
VBA of the password itself:

Here is the VBA of my recording:
Sub testh()
'
' testh Macro
' Ini adalah untuk mengetest kalau pakai password
'
' Keyboard Shortcut: Ctrl+Shift+H
'
ChDir "\\Admin-hdd\budget-contr\BUDGET CONTROL M\BUDGET 2009"
Workbooks.Open Filename:= _
"\\Admin-hdd\budget-contr\BUDGET CONTROL M\BUDGET 2009\M10-9-006
ASAHI.xlsx", _
UpdateLinks:=0
End Sub


Thanks for any help.

Frank
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default password in VBA

Search VBA's help for "Open Method"
Then open the link for "Open method as it applies to the Workbooks object."

You'll see how you can pass parms to the .open statement:

expression.Open(FileName, UpdateLinks, ReadOnly, Format, Password,
WriteResPassword, IgnoreReadOnlyRecommended, Origin, Delimiter, Editable,
Notify, Converter, AddToMru, Local, CorruptLoad)

So just like you passed an option (the updatelinks stuff), you can use:

Workbooks.Open Filename:= _
"\\Admin-hdd\budget-contr\BUDGET CONTROL M\BUDGET 2009\M10-9-006 ASAHI.xlsx", _
UpdateLinks:=0, password:="topsecretpassword"



Frank Situmorang wrote:

Hello,

I am trying to understand how macro will write the password in VBAmby using
recording Macro for a protected password workbooks, because I am trying to
make a link base on the example 1 of Mr. Ron De Bruin, but I can not see the
VBA of the password itself:

Here is the VBA of my recording:
Sub testh()
'
' testh Macro
' Ini adalah untuk mengetest kalau pakai password
'
' Keyboard Shortcut: Ctrl+Shift+H
'
ChDir "\\Admin-hdd\budget-contr\BUDGET CONTROL M\BUDGET 2009"
Workbooks.Open Filename:= _
"\\Admin-hdd\budget-contr\BUDGET CONTROL M\BUDGET 2009\M10-9-006
ASAHI.xlsx", _
UpdateLinks:=0
End Sub

Thanks for any help.

Frank


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default password in VBA

Thanks Dave for your response.
The problem Dave, because in the Ron's example, Getopenfile alrready
determinded the workbooks path, how can we make the password VBA fit with
this Getopenfile, because we like it, that we can link with anyother folder
without writing the file path, like you showed.

Thanks for giving me more explanantion,

Frank

"Dave Peterson" wrote:

Search VBA's help for "Open Method"
Then open the link for "Open method as it applies to the Workbooks object."

You'll see how you can pass parms to the .open statement:

expression.Open(FileName, UpdateLinks, ReadOnly, Format, Password,
WriteResPassword, IgnoreReadOnlyRecommended, Origin, Delimiter, Editable,
Notify, Converter, AddToMru, Local, CorruptLoad)

So just like you passed an option (the updatelinks stuff), you can use:

Workbooks.Open Filename:= _
"\\Admin-hdd\budget-contr\BUDGET CONTROL M\BUDGET 2009\M10-9-006 ASAHI.xlsx", _
UpdateLinks:=0, password:="topsecretpassword"



Frank Situmorang wrote:

Hello,

I am trying to understand how macro will write the password in VBAmby using
recording Macro for a protected password workbooks, because I am trying to
make a link base on the example 1 of Mr. Ron De Bruin, but I can not see the
VBA of the password itself:

Here is the VBA of my recording:
Sub testh()
'
' testh Macro
' Ini adalah untuk mengetest kalau pakai password
'
' Keyboard Shortcut: Ctrl+Shift+H
'
ChDir "\\Admin-hdd\budget-contr\BUDGET CONTROL M\BUDGET 2009"
Workbooks.Open Filename:= _
"\\Admin-hdd\budget-contr\BUDGET CONTROL M\BUDGET 2009\M10-9-006
ASAHI.xlsx", _
UpdateLinks:=0
End Sub

Thanks for any help.

Frank


--

Dave Peterson

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default password in VBA

You have to know the password for the file--no matter what the user chose.

And the password is a parameter on the .open line--not the .getopenfilename
line.

If you don't know the password for that file, maybe you could just ask the user
or show the open dialog and have the user do the work.

Dim res As Boolean
Dim wkbk As Workbook

res = Application.Dialogs(xlDialogOpen).Show

If res = False Then
MsgBox "nothing opened"
Else
Set wkbk = ActiveWorkbook
MsgBox wkbk.FullName
End If



Frank Situmorang wrote:

Thanks Dave for your response.
The problem Dave, because in the Ron's example, Getopenfile alrready
determinded the workbooks path, how can we make the password VBA fit with
this Getopenfile, because we like it, that we can link with anyother folder
without writing the file path, like you showed.

Thanks for giving me more explanantion,

Frank

"Dave Peterson" wrote:

Search VBA's help for "Open Method"
Then open the link for "Open method as it applies to the Workbooks object."

You'll see how you can pass parms to the .open statement:

expression.Open(FileName, UpdateLinks, ReadOnly, Format, Password,
WriteResPassword, IgnoreReadOnlyRecommended, Origin, Delimiter, Editable,
Notify, Converter, AddToMru, Local, CorruptLoad)

So just like you passed an option (the updatelinks stuff), you can use:

Workbooks.Open Filename:= _
"\\Admin-hdd\budget-contr\BUDGET CONTROL M\BUDGET 2009\M10-9-006 ASAHI.xlsx", _
UpdateLinks:=0, password:="topsecretpassword"



Frank Situmorang wrote:

Hello,

I am trying to understand how macro will write the password in VBAmby using
recording Macro for a protected password workbooks, because I am trying to
make a link base on the example 1 of Mr. Ron De Bruin, but I can not see the
VBA of the password itself:

Here is the VBA of my recording:
Sub testh()
'
' testh Macro
' Ini adalah untuk mengetest kalau pakai password
'
' Keyboard Shortcut: Ctrl+Shift+H
'
ChDir "\\Admin-hdd\budget-contr\BUDGET CONTROL M\BUDGET 2009"
Workbooks.Open Filename:= _
"\\Admin-hdd\budget-contr\BUDGET CONTROL M\BUDGET 2009\M10-9-006
ASAHI.xlsx", _
UpdateLinks:=0
End Sub

Thanks for any help.

Frank


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 36
Default password in VBA

Sorry Dave...may be I have language problem, where shall we put this VBA
Workbooks.Open Filename:= _
"\\Admin-hdd\budget-contr\BUDGET CONTROL M\BUDGET 2009\M10-9-006
ASAHI.xlsx", _
UpdateLinks:=0, password:="topsecretpassword"
the password, and there are about 500 workbooks of the project with the
same password.

What I got in Rons's website is using GetOpen file without tupenging the
path, and we can just choose the files we want to link, and everythng is
done. So How can I fit it with your suggestion

Thanks very much

Frank

"Dave Peterson" wrote:

You have to know the password for the file--no matter what the user chose.

And the password is a parameter on the .open line--not the .getopenfilename
line.

If you don't know the password for that file, maybe you could just ask the user
or show the open dialog and have the user do the work.

Dim res As Boolean
Dim wkbk As Workbook

res = Application.Dialogs(xlDialogOpen).Show

If res = False Then
MsgBox "nothing opened"
Else
Set wkbk = ActiveWorkbook
MsgBox wkbk.FullName
End If



Frank Situmorang wrote:

Thanks Dave for your response.
The problem Dave, because in the Ron's example, Getopenfile alrready
determinded the workbooks path, how can we make the password VBA fit with
this Getopenfile, because we like it, that we can link with anyother folder
without writing the file path, like you showed.

Thanks for giving me more explanantion,

Frank

"Dave Peterson" wrote:

Search VBA's help for "Open Method"
Then open the link for "Open method as it applies to the Workbooks object."

You'll see how you can pass parms to the .open statement:

expression.Open(FileName, UpdateLinks, ReadOnly, Format, Password,
WriteResPassword, IgnoreReadOnlyRecommended, Origin, Delimiter, Editable,
Notify, Converter, AddToMru, Local, CorruptLoad)

So just like you passed an option (the updatelinks stuff), you can use:

Workbooks.Open Filename:= _
"\\Admin-hdd\budget-contr\BUDGET CONTROL M\BUDGET 2009\M10-9-006 ASAHI.xlsx", _
UpdateLinks:=0, password:="topsecretpassword"



Frank Situmorang wrote:

Hello,

I am trying to understand how macro will write the password in VBAmby using
recording Macro for a protected password workbooks, because I am trying to
make a link base on the example 1 of Mr. Ron De Bruin, but I can not see the
VBA of the password itself:

Here is the VBA of my recording:
Sub testh()
'
' testh Macro
' Ini adalah untuk mengetest kalau pakai password
'
' Keyboard Shortcut: Ctrl+Shift+H
'
ChDir "\\Admin-hdd\budget-contr\BUDGET CONTROL M\BUDGET 2009"
Workbooks.Open Filename:= _
"\\Admin-hdd\budget-contr\BUDGET CONTROL M\BUDGET 2009\M10-9-006
ASAHI.xlsx", _
UpdateLinks:=0
End Sub

Thanks for any help.

Frank

--

Dave Peterson


--

Dave Peterson



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default password in VBA

If you know the password for any file that the user can choose, then change it
in that workbooks.open line.

I used:
password:="topsecretpassword"

But you can replace that top secret password with what you need it to be.



Frank Situmorang wrote:

Sorry Dave...may be I have language problem, where shall we put this VBA
Workbooks.Open Filename:= _
"\\Admin-hdd\budget-contr\BUDGET CONTROL M\BUDGET 2009\M10-9-006
ASAHI.xlsx", _
UpdateLinks:=0, password:="topsecretpassword"
the password, and there are about 500 workbooks of the project with the
same password.

What I got in Rons's website is using GetOpen file without tupenging the
path, and we can just choose the files we want to link, and everythng is
done. So How can I fit it with your suggestion

Thanks very much

Frank

"Dave Peterson" wrote:

You have to know the password for the file--no matter what the user chose.

And the password is a parameter on the .open line--not the .getopenfilename
line.

If you don't know the password for that file, maybe you could just ask the user
or show the open dialog and have the user do the work.

Dim res As Boolean
Dim wkbk As Workbook

res = Application.Dialogs(xlDialogOpen).Show

If res = False Then
MsgBox "nothing opened"
Else
Set wkbk = ActiveWorkbook
MsgBox wkbk.FullName
End If



Frank Situmorang wrote:

Thanks Dave for your response.
The problem Dave, because in the Ron's example, Getopenfile alrready
determinded the workbooks path, how can we make the password VBA fit with
this Getopenfile, because we like it, that we can link with anyother folder
without writing the file path, like you showed.

Thanks for giving me more explanantion,

Frank

"Dave Peterson" wrote:

Search VBA's help for "Open Method"
Then open the link for "Open method as it applies to the Workbooks object."

You'll see how you can pass parms to the .open statement:

expression.Open(FileName, UpdateLinks, ReadOnly, Format, Password,
WriteResPassword, IgnoreReadOnlyRecommended, Origin, Delimiter, Editable,
Notify, Converter, AddToMru, Local, CorruptLoad)

So just like you passed an option (the updatelinks stuff), you can use:

Workbooks.Open Filename:= _
"\\Admin-hdd\budget-contr\BUDGET CONTROL M\BUDGET 2009\M10-9-006 ASAHI.xlsx", _
UpdateLinks:=0, password:="topsecretpassword"



Frank Situmorang wrote:

Hello,

I am trying to understand how macro will write the password in VBAmby using
recording Macro for a protected password workbooks, because I am trying to
make a link base on the example 1 of Mr. Ron De Bruin, but I can not see the
VBA of the password itself:

Here is the VBA of my recording:
Sub testh()
'
' testh Macro
' Ini adalah untuk mengetest kalau pakai password
'
' Keyboard Shortcut: Ctrl+Shift+H
'
ChDir "\\Admin-hdd\budget-contr\BUDGET CONTROL M\BUDGET 2009"
Workbooks.Open Filename:= _
"\\Admin-hdd\budget-contr\BUDGET CONTROL M\BUDGET 2009\M10-9-006
ASAHI.xlsx", _
UpdateLinks:=0
End Sub

Thanks for any help.

Frank

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to retrive password protected worksheet but forgot password? Laurie Excel Worksheet Functions 1 November 19th 09 09:42 PM
PASSWORD REMOVAL I have the password to open the file and the password to modify the file now how to remove them LJ[_4_] Excel Programming 0 April 27th 06 03:18 AM
how to automate opening a password protected excel file? e.g. a .xls that has a password set in the security tab. Daniel Excel Worksheet Functions 0 June 23rd 05 11:56 PM
bypass password when update linking of password protected file Yan Excel Discussion (Misc queries) 1 February 7th 05 11:29 PM
Excel password but cant hide the sheets before entering password cakonopka[_3_] Excel Programming 1 January 30th 04 06:28 PM


All times are GMT +1. The time now is 12:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"