Question Not able to open protected excel file

alokmpatel

Member
Joined
Dec 20, 2014
Messages
6
Programming Experience
Beginner
Dear all,


I am new to vb.net. (using Visual Studio 2010, Win 7, office 2010)
i used below code for open the password protected excel file. please help me to correct this code.

My code is not giving any error msg. but it is not writing password. (see attached file)


Imports Excel = Microsoft.Office.Interop.Excel
Imports Microsoft.Office.Interop


Public Class Form1
Dim strExcelPath As String = "C:\00.SOFT\01.XYZ\XYZ_V1.0.xlsm"
Dim xlApp = New Excel.Application()
Dim xlWbs = xlApp.Workbooks
Dim xlBook = xlWbs.Open(strExcelPath)
Dim xlSheet = xlBook.Worksheets(1)

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load


xlApp.DisplayAlerts = False
xlApp.Visible = False

xlBook = xlApp.workbooks.Open(strExcelPath, password:="xxxxx", updatelinks:=False)


End Sub
End Class
 

Attachments

  • 2014-12-20_163452.png
    2014-12-20_163452.png
    4.6 KB · Views: 33
Last edited:

alokmpatel

Member
Joined
Dec 20, 2014
Messages
6
Programming Experience
Beginner
Can any one help me..please..:upset:
i Dont know is there any reference missing or what?? when i start debugging (F5) above msg box for Password is coming.

Thanks in advance for support.:encouragement:
 
Top Bottom