alerte VBs

alerte VBs - VB/VBA/VBS - Programmation

Marsh Posté le 19-01-2013 à 13:24:46    

Bonjour;
 
j'ai un classeur excel dont chaque feuille contient une colonne une date de délai à ne pas dépasser en effectuant de s recherches et avec de l'aide j'ai mis ai point ce programme  
le but est de parcourir la bonne colonne concernée K, se trouvant sur chaque feuille différente , ensuite de préciser ensuite d’être prévenu par un alerte vbs qu'il reste 10 jours avant l'échéance:
 
Dim objExcel
REM the path to the excel file
Dim excelPath
REM how many worksheets are in the current excel file
Dim worksheetCount
Dim counter
REM the worksheet we are currently getting data from
Dim WorkSheet1
REM the number of columns in the current worksheet that have data in them
Dim usedColumnsCount
REM the number of rows in the current worksheet that have data in them
Dim usedRowsCount
Dim row
Dim column
REM the topmost row in the current worksheet that has data in it
Dim top
REM the leftmost row in the current worksheet that has data in it
Dim left
Dim Cells
REM the current row and column of the current worksheet we are reading
Dim curCol
Dim curRow
REM the value of the current row and column of the current worksheet we are reading
Dim word
 
 
REM where is the Excel file located?
excelPath = "C:\Users\user\Desktop\d\Amended Office Actions' Schedule TM Appln "
 
WScript.Echo "Reading Data from " & excelPath
 
REM Create an invisible version of Excel
Set objExcel = CreateObject("Excel.Application" )
 
REM don't display any messages about documents needing to be converted
REM from  old Excel file formats
objExcel.DisplayAlerts = 0
 
REM open the excel document as read-only
REM open (path, confirmconversions, readonly)
objExcel.Workbooks.open excelPath, false, true
 
 REM Loop through each worksheet
For counter = 1 to workSheetCount
 WScript.Echo "-----------------------------------------------"
 WScript.Echo "Reading data from worksheet " & counter & vbCRLF

 Set WorkSheet1 = objExcel.ActiveWorkbook.Worksheets(counter)
 REM how many columns are used in the current worksheet
 usedColumnsCount = WorkSheet1.UsedRange.Columns.Count
 REM how many rows are used in the current worksheet
 usedRowsCount = WorkSheet1.UsedRange.Rows.Count
 
 REM What is the topmost row in the spreadsheet that has data in it
 top = Worksheet1.UsedRange.Row
 REM What is the leftmost column in the spreadsheet that has data in it
 left = Worksheet1.UsedRange.Column
 
 
 Set Cells = Worksheet1.Cells
 REM Loop through each row in the worksheet  
 For row = 0 to (usedRowsCount-1)
   
  REM Loop through each column in the worksheet  
  For column = K to usedColumnsCount-1
   REM only look at rows that are in the "used" range
   curRow = row+top
   REM only look at columns that are in the "used" range
   curCol = column+left
   REM get the value/word that is in the cell  
   word = Cells(curRow,curCol).Value
   REM display the column on the screen
   WScript.Echo (word)
  Next
 Next
 
Next  [/#0046B8]
   
 Sub For_X_to_Next_Colonne()
[#FF2A00]Dim FL1 As Worksheet, Cell As Range, NoCol As Integer[/#FF2A00]
Dim NoLig As Long, DerLig As Long, Var As Variant
 
    'Instance de la feuille qui permet d'utiliser FL1 partout dans
    'le code à la place du nom de la feuille
    Set FL1 = Worksheets("Provisional Refusal TM. Appln." )
     
    'Détermine la dernière ligne renseignée de la feuille de calculs
    '(Voir explication sur l'utilisation de Split en bas de cette discussion)
    DerLig = Split(FL1.UsedRange.Address, "$" )(4)
     
    'Fixe le N° de la colonne à lire
    NoCol = 10
     
    'Utilisation du N° de ligne dans une boucle For ... Next
    For NoLig = 1 To DerLig
        Var = FL1.Cells(NoLig, NoCol)
         
        'Pour tester : Affiche les variables dans la fenêtre Exécution de VBA
        Debug.Print Var
    Next
    Set FL1 = NoThing
End Sub
 If (ActiveCell.Value > DateAdd("m", 10, Date)) Then
             Msgbox"Il reste 10 jours avant the dead line"
        End If
        ActiveCell.Offset(1, 0).Select
         
    Loop
 
 
 
objExcel.Workbooks(1).Close
objExcel.Quit[/#0046B8][/#FF0000][/#FF3800][/#FF8D00][/#FFAA00][/#FFE200][/#FFFF00][/#38FF00][/#2AFF00][/#00FF00][/#00F00E][/#009B63][/#0055AA][/#0E00F0][/#5500AA][/#71008D][/#B80046][/#D4002A][/#F0000E][/#7F007F][/#71008D][/#5500AA][/#0E00F0][/#0000FF][/#0046B8]
 
 
 
le message d’erreur indique fin de l'instruction attendue à ligne écrite en rouge
 
 
1/ que faire pour que cela marche
2/comment paramétrer windows pour que le pc lance le message d'alerte ai démarrage du pc
 
MEECI D'2AVANCE :hello:  

Reply

Marsh Posté le 19-01-2013 à 13:24:46   

Reply

Marsh Posté le 25-01-2013 à 22:38:33    

vien sur mon tuto svp il a un problème dans ton scripts déja

Reply

Marsh Posté le 27-01-2013 à 18:18:26    

bonjour
ou se trouve votre tuto SVP

Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed