VB Code:
Set objXl = New Excel.Application Set objWkb = objXl.Workbooks.Open(Text1.Text) directory = App.Path & IIf(Right(App.Path, 1) = "\", "", "\") fName = Mid$(Text1.Text, InStrRev(Text1.Text, "\") + 1) Set fso = New FileSystemObject objWkb.SaveAs FileName:="" & directory & "" & fso.GetBaseName(fName) & ".xls" objWkb.Saved = True objWkb.Close Set objWkb = Nothing Set objXl = Nothing MsgBox "done" Set cn = New ADODB.Connection With cn .Provider = "MSDASQL" .ConnectionString = "Driver={Microsoft Excel Driver (*.xls)};" & _ "DBQ=C:\Documents and Settings\admin\My Documents\Paul\prjReadTxt\Copy of Book1.xls; ReadOnly=True;" .Open End With
when in cn.Open it occurs this error..




Reply With Quote