Home Forums General Discussion Any EXCEl vb gurus about

This topic contains 6 replies, has 2 voices, and was last updated by  Anonymous 14 years, 6 months ago.

  • Author
  • #3931


    im trying to build this simple vb macro for excel which basically closes the opened workbook when its idle for a couple of minutes.

    i know how to call the function to close etc.

    at moment i have this called at the opening of the book and it closes the book after 10 seconds.

    what i want to know is, is there a function which gets called when the spreadsheet is idle. i.e. so i can put a timer or something, which when it goes off it calls my shutdown?

    Seems like a common enough think you’d want to do, but ive spent 2 hours looking on the web and the doc on vb is bloody shocking. seems like theres no api documentation for the fecking language.

    also while im at it, is there a function which gets called repeatively when the workbook is active? i.e. where i can reset the timer


  • #19178


    Hmmm, you might only frustrate yourself trying to do this with VBA for Excel.

    If you only have one sheet in your workbook you might look at the Workbook SheetActivate event. I haven’t used it myself but perhaps you could activate your timer in there.

    Private Sub Workbook_SheetActivate(ByVal Sh As Object)
    //Your code here
    End Sub

    The most thorough VB resource on the web is at MSDN, http://msdn.microsoft.com/vbasic/ but if you haven’t found an answer to your question using Google it’s unlikely to be out there on the web.

  • #19179


    nice one thanks for the help
    ya i suspect if google can find it, its not there :)

  • #19183


    Well, I’m not sure how much help it really is. You can go round in circles trying to find out how to do exactly what you want in VB!

  • #19185


    i hate the feckin things. its not a real programming language at all. they made the thing so high level and vague that its useless.

  • #19187


    Eep! Ah, it’s not all that bad, just very inflexible for a programming language. It’s good at what it’s good at (rapid development, accessing recordsets, that kinda lark) and terrible at what it’s not.

    Also the syntax examples they give in documentation are generally not varied enough to be of any real help.

  • #19188


    give me C++ or java any day.

The forum ‘General Discussion’ is closed to new topics and replies.