Tarea queda en memoria al terminar excel

Como poder pasar en archivo plano (txt)a excel, yo lo estoy ejecutando de esta manera pero,pero excel se queda como taera en memoria.
Codigo:
Dim objExcel As Excel.Application
Dim objWorkbook As Excel.Workbook
Dim objExcelSheet As Excel.Worksheet
Set objExcel = New Excel.Application
Set objWorkbook = objExcel.Workbooks.Add
Set objWorkbook = Nothing
ChDir "C:\"
Workbooks.OpenText FileName:="C:\Muka.txt", Origin:=xlWindows, StartRow:= _
1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=True, _
Space:=False, 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), Array(10 _
, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array(14, 1), Array(15, 1), Array(16, 1), _
Array(17, 1), Array(18, 1), Array(19, 1), Array(20, 1), Array(21, 1), Array(22, 1), Array( _
23, 1), Array(24, 1), Array(25, 1), Array(26, 1), Array(27, 1), Array(28, 1), Array(29, 1))
Selection.End(xlDown).Select
Cells.Select
Cells.EntireColumn.AutoFit
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Font.Bold = True
objExcel.Visible = True
ActiveWorkbook.SaveAs FileName:="C:\Muka2.xls", FileFormat _
:=xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:= _
False, CreateBackup:=False
Set objExcelSheet = Nothing
Set objExcel = Nothing

1 Respuesta

Respuesta
1
Ya esta depurado,
Dim objExcel As New Excel.Application
Dim objWorkbook As Excel.Workbook
Dim objExcelSheet As Excel.Worksheet
Set objWorkbook = objExcel.Workbooks.Add
Set objWorkbook = Nothing
ChDir "C:\"
Workbooks.OpenText FileName:="C:\Muka.txt", Origin:=xlWindows, StartRow:= _
1, DataType:=xlDelimited, TextQualifier:=xlDoubleQuote, _
ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, Comma:=True, _
Space:=False, 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), Array(10 _
, 1), Array(11, 1), Array(12, 1), Array(13, 1), Array(14, 1), Array(15, 1), Array(16, 1), _
Array(17, 1), Array(18, 1), Array(19, 1), Array(20, 1), Array(21, 1), Array(22, 1), Array( _
23, 1), Array(24, 1), Array(25, 1), Array(26, 1), Array(27, 1), Array(28, 1), Array(29, 1))
Selection.End(xlDown).Select
Cells.Select
Cells.EntireColumn.AutoFit
Range("A1").Select
Range(Selection, Selection.End(xlToRight)).Select
Selection.Font.Bold = True
objExcel.Visible = True
ActiveWorkbook.SaveAs FileName:="C:\Muka2.xls", FileFormat _
:=xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:= _
False, CreateBackup:=False
ActiveWorkbook.Close
objExcel.Visible = False
Set objExcelSheet = Nothing
Set objExcel = Nothing
El problema era que abrias los objetos pero no los cerrabas, ahora ya no queda en ejecucion.
Salu2
PCBurner
¿Probaste esta solucion?
Por favor si es asi valora y cierra la pregunta en todoexpertos.com
Salu2
PCBurner

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas