• VB6 – in toolbox – there is a timer control (VB6)

    Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » VB6 – in toolbox – there is a timer control (VB6)

    Author
    Topic
    #358789

    Is there a reason you don’t want to use the VBA OnTime method which should be able to do the same thing?

    Viewing 1 reply thread
    Author
    Replies
    • #536094

      Hi ya

      In VB6 – in the toolbox – there is a timer control- which I would like to implement & have in my VBA code.
      Can I bring the timer control into VBA?
      How do I bring it in?
      Do I need to add reference libraries?
      Do I need to load .dlls onto my c drive?

      thanks in advance – Diana.

    • #536118

      HI Leagre

      What I’m doing is sending the document to the printer
      with PrintOut Background:=True
      (meaning the code continues to run while word prints)
      & I need to determine if file has completed spooling/ printing before I can continue my code.

      when I use the OnTime method
      the result is
      for some reason the application doesnt freeze but is caught up in some loop & ‘pauses’ or freezes the printer spooling.
      So I tested on a large document eg 70 pages
      the code runs onTime
      sends document to print
      & stops spooling on page 2 & doesnt complete
      so I have to CTRL Break to stop the code
      as its in some loop.

      I’ve been frying about the timer code for a few weeks.
      I thought I’ld use the VB6 timer control
      & do like a time counter & see if that works.

      Another solution was
      set background to False
      eg PrintOut Background:=False
      this means it will the code will stop until printing is completed & then code resume when prining completed.

      With Background set to False – this displays a default
      word dialog box (see attachment of sample).
      I thought if I could capture this default word message box & before capturing hide the message box & display my own custom message box.

      – this will work but I dont know how to capture or hide the default word message box.
      any ideas?
      Diana

      • #536121

        Timers don’t do what you seem to think they do. Timers interrupt other code and override it, which is probably why you haven’t had any success with the OnTime method. You’re better off with the alternative method.

      • #536132

        Diana,

        I couldn’t find a way to reference the timer control from VBA.

        I don’t know if this KB article on DoEvents might help.

        Or would:
        Application.DisplayAlerts = wdAlertsNone

        Get rid of your message box?

        • #536230

          I never could find a way to put a timer into Word. Instead I wrote a VB program that automates Word and sets the timer. After the timer runs out(The program set it for a minute), the program checks the number of documents in the print spool. If there are still some, the program set the timer again until the number of docs in the print spool is zero.

          This was for a program that converted piles of documents to PDF on a daily basis.

      • #536197

        I don’t know what you had in mind for checking the spooler status, but you might try putting it into a Do Until loop.
        For example:
        In your print procedure…

        Do Until SpoolerFinished = True
        DoEvents
        Loop

        Then a separate function…
        Function SpoolerFinished() As Boolean
        ‘Code to check spooler status…
        End Function

        Darryl

    Viewing 1 reply thread
    Reply To: VB6 – in toolbox – there is a timer control (VB6)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: