Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Error 1004 in run time in method cells from object global
Message
De
16/03/2006 11:09:29
 
 
À
Tous
Information générale
Forum:
Visual Basic
Catégorie:
COM, DCOM et OLE automation
Titre:
Error 1004 in run time in method cells from object global
Divers
Thread ID:
01104905
Message ID:
01104905
Vues:
67
HI, I am using Visual basic 6.0 and excel 97, When I run the program the first time it runs very well, but if I run the program again sends me the error 1004 in run time in metod cells from object global.

This is my code:
    Dim obj As Object
    Set obj = CreateObject("Excel.Application")
        obj.Workbooks.OpenText FileName:= _
        "C:\EXPORT.TXT", Origin:=xlWindows, _
        StartRow:=1, DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 1),   Array(5, _
        1), Array(9, 1), Array(18, 1), Array(27, 1), Array(32, 1), Array(37, 1), Array(48, 1), Array _
        (60, 1), Array(66, 1), Array(73, 1), Array(135, 1))
    Sheets("EXPORT").Select
    Columns("A:A").Select
    Selection.Delete Shift:=xlToLeft
    Columns("D:H").Select
    Selection.Delete Shift:=xlToLeft
    Columns("F:L").Select
    Selection.Delete Shift:=xlToLeft
    Rows("1:1").Select
    Selection.Insert Shift:=xlDown
    Range("A1").Select
    ActiveCell.FormulaR1C1 = "UNIDAD"
    Range("B1").Select
    ActiveCell.FormulaR1C1 = "FECHA"
    Range("C1").Select
    ActiveCell.FormulaR1C1 = "HORA"
    Range("D1").Select
    ActiveCell.FormulaR1C1 = "NUM"
    Range("E1").Select
    ActiveCell.FormulaR1C1 = "UBICA"
    Range("F1").Select
    ActiveWorkbook.SaveAs FileName:= _
        "C:\EXPORT.xls", FileFormat:=xlNormal _
        , Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
        CreateBackup:=False
         obj.Workbooks.Close
         obj.Application.Quit
    
    Set obj = Nothing
Thanks in advance
Répondre
Fil
Voir

Click here to load this message in the networking platform