Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
how can I open a password protected document through vb?
I am using the GetObject(filename) command to open up an excel spreadsheet
from a VB program. The excel spreadsheet opens up but it is requesting the password and the writerespassword. How can I supply them through code so that the user never sees this? Many Thanks June |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
how can I open a password protected document through vb?
I don't speak the VB, but this worked ok for me in word:
Option Explicit Sub testme01() Dim oExcel Dim oWorkBook Dim xlWasRunning As Boolean xlWasRunning = True On Error Resume Next Set oExcel = GetObject(, "Excel.Application") If Err Then Set oExcel = CreateObject("Excel.Application") xlWasRunning = False End If oExcel.Visible = True Set oWorkBook = oExcel.Workbooks.Open("C:\my documents\excel\book10.XLS", _ Password:="a", WriteResPassword:="b") 'do stuff oWorkBook.Close False Set oWorkBook = Nothing If xlWasRunning Then 'do nothing Else oExcel.Quit Set oExcel = Nothing End If End Sub June Macleod wrote: I am using the GetObject(filename) command to open up an excel spreadsheet from a VB program. The excel spreadsheet opens up but it is requesting the password and the writerespassword. How can I supply them through code so that the user never sees this? Many Thanks June -- Dave Peterson |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Exception to password-protected document | Excel Discussion (Misc queries) | |||
Password protected document with new level of security for Office | Excel Discussion (Misc queries) | |||
I forgot my password to open an excel document, how do I open it? | Excel Discussion (Misc queries) | |||
Linking to a Password Protected Document in Excel 2000 | Excel Discussion (Misc queries) | |||
Open password protected workbook. | Excel Programming |