vipersmind
it can't be!
- Local time
- Tomorrow, 07:40
- Joined
- Dec 26, 2002
- Messages
- 82
I am having to open a delimted .LAS file in excel as access will not import a file that is both TAB and SPACE delimited.
The following code is meant to open the delimented .LAS file in excel and save it as LasImport.txt.
I am getting the following error
Object does not support this property or method
Please help as i have tried many mnay variations and am receiving various messages in error
the part of the code oWb.Workbook.OpenText filename i copied from the excel vb.
Also Excel will not close!
. It is still shows an instance in taskmanager.
I have read many posts on this and still can't fix it.
Regards
Cress
The following code is meant to open the delimented .LAS file in excel and save it as LasImport.txt.
I am getting the following error
Object does not support this property or method
Please help as i have tried many mnay variations and am receiving various messages in error
the part of the code oWb.Workbook.OpenText filename i copied from the excel vb.
Also Excel will not close!
I have read many posts on this and still can't fix it.
Regards
Cress
Code:
Dim oXL As Excel.Application
Dim oWb As Excel.Workbook
Dim oWs As Excel.Worksheet
Dim x As Integer
Set oXL = New Excel.Application
Set oWb = oXL.Workbooks.Add
Set oWs = oWb.Sheets(1)
strSelectedFile = Forms![frmGamma]![cbSelectGammaFile]
ChDir "C:\database\imports\surtec\import"
oWb.Workbook.OpenText filename:="C:\database\imports\surtec\import\"& strSelectedFile , _
Origin:=437, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True, Semicolon:=False, _
Comma:=False, Space:=True, Other:=False, FieldInfo:=Array(Array(1, 1), _
Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7, 1), Array(8, 1), _
Array(9, 1)), TrailingMinusNumbers:=True
Set oWs = Nothing
oXL.ScreenUpdating = True
Kill "C:\database\imports\surtec\import\LasImport.txt"
oWb.SaveAs "C:\database\imports\surtec\import\LasImport.txt"
DoEvents
oXL.DisplayAlerts = False
For x = 1 To oXL.Workbooks.Count
oXL.Workbooks(x).Saved = True
oXL.Workbooks(x).Close False
Next x
Set oWb = Nothing
oXL.Quit
Set oXL = Nothing
Last edited: