vipersmind
it can't be!
- Local time
- Today, 15:30
- Joined
- Dec 26, 2002
- Messages
- 82
I have looked through this Forum backwards and forwards
I am using the following code to open a .las file (essentially a text file) in excel and save it as a .txt file, then import it into access.
I cannot get rid of the instance of Excel that open during this process
The rest of the code works a treat...
I have read many posts but cannot seem to find the answer
Thanks in Advance for you help
Cress
I am using the following code to open a .las file (essentially a text file) in excel and save it as a .txt file, then import it into access.
I cannot get rid of the instance of Excel that open during this process
The rest of the code works a treat...
I have read many posts but cannot seem to find the answer
Thanks in Advance for you help
Cress
Code:
Option Compare Database
Option Explicit
Private xl As Object
________________________________________________________________
Public Sub ModifyExportedExcelFileFormats(sFile As String)
On Error GoTo Err_ModifyExportedExcelFileFormats
Dim xlApp As Excel.Application
Dim xlSheet As Object
Dim strSelectedFile As String
strSelectedFile = Forms![frmGamma]![cbSelectGammaFile_Nav]
Set xlApp = CreateObject("Excel.Application")
Set xlSheet = xlApp.Workbooks.Open("C:\database\imports\Gamma\Navaids\import\" & strSelectedFile).Sheets(1)
Workbooks.OpenText filename:= _
"C:\database\imports\Gamma\Navaids\import\" & strSelectedFile, Origin:=437, _
StartRow:=1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=False, Semicolon:=False, Comma:=False _
, Space:=False, Other:=True, OtherChar:=":", FieldInfo:=Array(Array(1, 1 _
), Array(2, 1)), TrailingMinusNumbers:=True
ActiveWorkbook.SaveAs filename:= _
"C:\database\imports\Gamma\Navaids\import\LasImport.txt", FileFormat:=xlText _
, CreateBackup:=False
xlApp.ActiveWorkbook.Save
xlApp.ActiveWorkbook.Close
xlApp.UserControl = False
xlApp.Quit
Exit_ModifyExportedExcelFileFormats:
Exit Sub
Err_ModifyExportedExcelFileFormats:
MsgBox Err.Number & " - " & Err.Description
Resume Exit_ModifyExportedExcelFileFormats
End Sub