View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Christopher J Tallos Christopher J Tallos is offline
external usenet poster
 
Posts: 1
Default Check if Excel file is password protected

The follwing code throws up a prompt for a password when the Excel file is
password protected (it is vb.net).

ExcelWorkBook = ExcelApplication.Workbooks.Open(ExcelFullName, Nothingobj,
True, Nothingobj, Nothingobj, Nothingobj, Nothingobj, Nothingobj,
Nothingobj, Nothingobj, Nothingobj, Nothingobj, Nothingobj, Nothingobj,
Nothingobj)

How do I detect in code (vb.net or c#) if an Excel workbook is password
protected when I get the prompt for password at the same time I am trying to
open it?