Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1899 connectés 

  FORUM HardWare.fr
  Programmation
  VB/VBA/VBS

  Run-time error '1004' : Application-defined od object-defined error

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Run-time error '1004' : Application-defined od object-defined error

n°1199480
bing2000
Posté le 14-09-2005 à 16:48:15  profilanswer
 

Bonjour à tous
 
 
me voilà face un petit problème depuis que j'ai migré en Office 2003. Dans une application j'ai la procédure suivante :  
 
Sub PrintCommentsForOneCustomer()
 
    '
    ' Imprimer les commentaires pour un client spécifique
    '
    Dim UpperLeftCorner As Range
    Dim myInvoiceComment(50, 2) As Variant
    Dim iComment As Long
    Dim myComment As String
     
    Application.ScreenUpdating = False
     
    Worksheets("Facture" ).Select
     
    Set UpperLeftCorner = Range("A10" )
    iComment = -1
     
    '
    ' Rassembler les commentaires
    '
     
    For Each area In UpperLeftCorner.CurrentRegion.SpecialCells(xlVisible).Areas
        iRow = area.Row
        maxRow = iRow + area.Rows.Count - 1
        For iRow = iRow To maxRow
            If Not IsEmpty(Cells(iRow, 28).Value) Then
                myComment = Trim(Cells(iRow, 28).Value)
                myCustomer = Cells(iRow, 1).Value
                 
                Found = False
                For iC = 0 To iComment
                    If myInvoiceComment(iC, 1) = myComment Then
                        Found = True
                        myInvoiceComment(iC, 0) = myInvoiceComment(iC, 0) & ", " & Cells(iRow, 8).Value
                        Exit For
                    End If
                Next iC
                '
                If Found = False And iComment < 50 Then
                    iComment = iComment + 1
                    myInvoiceComment(iComment, 1) = myComment
                    myInvoiceComment(iComment, 0) = Cells(iRow, 8).Value
                End If
            End If
        Next iRow
    Next area
     
    '
    ' Remplir le Worksheet avec ces commentaires
    '
    If iComment = -1 Then
        result = MsgBox("Aucun commentaire a été trouvé.", vbInformation + vbOKOnly, "Impression des commentaires" )
    Else
        Worksheets("ImprimerCommentaire" ).Select
        Cells(5, 2).Value = myCustomer
        Range(Cells(7, 2), Cells(57, 3)).Select
        Selection.ClearContents
        Selection.Rows.Hidden = False
        Selection.Cells = myInvoiceComment        Range(Cells((8 + iComment), 2), Cells(70, 3)).Rows.Hidden = True
        ActiveSheet.PrintOut
        DoEvents
        Worksheets("Facture" ).Select
    End If
     
     
 
End Sub
 
Ce qu'elle fait c'est tout simplement le remplissage d'un array pour coller celui-ci ensuite sur un sheet.
Mon problème apparaît au niveau de ligne en gras. Cette ligne permettait auparavant (Office2000) de coller mon array sur le sheet. Mais depuis que j'ai migré en office2003 --> plus moyen!!!!! :cry:  
 
Après une petit analyse il semblerait que le problème vienne de la taille de ce que je veux coller. En effet il est possible que la deuxième colonne de mon array contienne une chaine très longue. J'ai fait le test en baissant la taille de la chaine de caractère et jusque 910 charactères, ma procédure marche comme avant sauf qu'en 2000 je n'avais pas de problème de limitation.
 
J'aimerai n'avoir aucune limite comme c'était le cas avant.
 
Qlq un a une idee parce que là je seche!!!!  :sarcastic:  
Merci d'avance pour votre aide
 
@+ tard
 
bing2000

mood
Publicité
Posté le 14-09-2005 à 16:48:15  profilanswer
 


Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  VB/VBA/VBS

  Run-time error '1004' : Application-defined od object-defined error

 

Sujets relatifs
[C] Provoquez des IO ErrorProbléme visual C++ library error
Test application lancée (débutant)Lancer une application et communiquer avec
Application client/serveur[Java] Drag&Drop dans une application JHotDraw
application avec un Still aliveApplication de style (juste deux lignes...)
[Débutant] Object[] récalcitrant ?plus presi que time()
Plus de sujets relatifs à : Run-time error '1004' : Application-defined od object-defined error


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR