Results 1 to 5 of 5
  1. #1
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    dubt.... on Time event (2000 sr 1)

    if i insert this macro in Auto Open event the macro IMPORTA_AGENZIE work at evry 5 minutes, and the macro START run only for one time?
    Private Sub Workbook_Open()
    Application.OnTime Now + TimeValue("00:05:00"), "IMPORTA_AGENZIE"
    Call START
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: dubt.... on Time event (2000 sr 1)

    The macro START will be run immediately after opening the workbook, and unless START calls itself with OnTime, it will run only once.
    The macro IMPORTA_AGENZIE will be run 5 minutes after the workbook has been opened, and unless IMPORTA_AGENZIE calls itself with OnTime, it will run only once.
    To make IMPORTA_AGENZIE run every 5 minutes, the line

    Application.OnTime Now + TimeValue("00:05:00"), "IMPORTA_AGENZIE"

    must be in the macro IMPORTA_AGENZIE itself.

  3. #3
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: dubt.... on Time event (2000 sr 1)

    if oi have understand ... and maintain in Auto Open the same line, or not?

    Sub IMPORTA_AGENZIE()

    Dim NomeDB As String
    Dim CONT As String
    Dim UTENTE As String
    Set ELENCO = Worksheets("A.T.CAMPANIA")
    NomeDB = gPROVADatabasePath

    '''''''''''''''''
    Application.OnTime Now + TimeValue("00:05:00"), "IMPORTA_AGENZIE"

    '''''''''''''''
    ELENCO.Range("L3:M5000").ClearContents
    ELENCO.Range("AB3:AB5000").ClearContents
    ELENCO.Range("AD3:AD5000").ClearContents

    'CONT = 2 'heets("A.T.CAMPANIA").Cells(65536, 1).End(xlUp).Row

    .................

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: dubt.... on Time event (2000 sr 1)

    In the Workbook_Open procedure, you can use

    Call IMPORTA_AGENZIE

    if you want to run it immediately (and then every 5 minutes), or

    Application.OnTime Now + TimeValue("00:05:00"), "IMPORTA_AGENZIE"

    if you want to run it 5 minutes after opening the workbook (and then every 5 minutes)

  5. #5
    Gold Lounger
    Join Date
    Jan 2004
    Location
    Italy
    Posts
    3,245
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: dubt.... on Time event (2000 sr 1)

    Good....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •