Home Forums General Discussion Any EXCEl vb gurus about

Welcome to our forums. These forums were active from 2003-2014. We have now decided to close them down, but will leave them here as an archive.

Remember you can send us feedback, news, jobs and content ideas by clicking here.

If you're really stuck for time, email news@gamedevelopers.ie.

You can also follow us on Twitter @gamedev_ie 

 

 

This topic contains 6 replies, has 2 voices, and was last updated by  peter_b 12 years, 4 months ago.

  • Author
    Posts
  • #3931

    peter_b
    Participant

    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

    thanks

  • #19178

    Earthhorse
    Participant

    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

    peter_b
    Participant

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

  • #19183

    Earthhorse
    Participant

    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

    peter_b
    Participant

    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

    Earthhorse
    Participant

    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

    peter_b
    Participant

    give me C++ or java any day.

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