View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Ricky Pang Ricky Pang is offline
external usenet poster
 
Posts: 53
Default one line macro to enter password for workbook

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!