View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Andy HP[_2_] Andy HP[_2_] is offline
external usenet poster
 
Posts: 1
Default Import from Excel to an access database using Jet in vb.net

I can import data from Excel to a non protected access database using the
code below.
How can I amend the code to import the data when 'myDatabase' is password
protected ?

Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
source=myExcelFile;Extended Properties='Excel 8.0;HDR=YES;'"
Comm.CommandType = CommandType.Text
Comm.CommandText = "SELECT * INTO tblNew IN 'myDatabase' FROM [Sheet1$]"
Comm.Connection = Conn
Conn.Open()
Comm.ExecuteNonQuery()
Conn.Close