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
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
Last edited: