dcsimg
Results 1 to 9 of 9

Thread: Monitoring writing data to xls file with VBA?

  1. #1

    Thread Starter
    Member kutlesh's Avatar
    Join Date
    Jun 2018
    Location
    Skopje, R. Macedonia
    Posts
    49

    Monitoring writing data to xls file with VBA?

    I made a script that executes several sql queries and writes them into separate worksheets inside xls workbook.

    I was wondering, is VBA so powerful that will enable me to monitor the writing progress?

    For example the first command wrote the first query and a visual component shows 10% of the job is done.
    Then a second sql command when done shows 20% done, etc...

    By the way, does VBA/Access 2000 has some progress component?

    In the end, which sub-forum contains info about this asynchronous processing?

  2. #2
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    1,435

    Re: Monitoring writing data to xls file with VBA?

    Quote Originally Posted by kutlesh View Post
    I made a script that executes several sql queries and writes them into separate worksheets inside xls workbook.

    I was wondering, is VBA so powerful that will enable me to monitor the writing progress?

    For example the first command wrote the first query and a visual component shows 10% of the job is done.
    Then a second sql command when done shows 20% done, etc...

    By the way, does VBA/Access 2000 has some progress component?

    In the end, which sub-forum contains info about this asynchronous processing?
    You got it working? (See other thread)
    As for your progress-thing: Check out the ProgressBar-Control
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    I say you're crazy not to!
    --------------------------------------------------------------------------------------------------
    For health reasons i try to avoid reading unformatted Code

  3. #3

    Thread Starter
    Member kutlesh's Avatar
    Join Date
    Jun 2018
    Location
    Skopje, R. Macedonia
    Posts
    49

    Re: Monitoring writing data to xls file with VBA?

    Hmm, are there query events on DAO.Database object?

    I mean when I run DAO.Database.Execute, are there events that I can use to do something when the SQL query starts running and when it finishes ?

    Or can I add events on writing files?

  4. #4

    Thread Starter
    Member kutlesh's Avatar
    Join Date
    Jun 2018
    Location
    Skopje, R. Macedonia
    Posts
    49

    Re: Monitoring writing data to xls file with VBA?

    I am going to assume VBA wasn't made so sophisticated
    And as it is, it was good for the time it was made at

  5. #5
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    1,435

    Re: Monitoring writing data to xls file with VBA?

    Quote Originally Posted by kutlesh View Post
    Hmm, are there query events on DAO.Database object?

    I mean when I run DAO.Database.Execute, are there events that I can use to do something when the SQL query starts running and when it finishes ?

    Or can I add events on writing files?
    AFAIK a resounding No for DAO.
    ADO on the other hand has an ExecuteComplete-Event
    https://msdn.microsoft.com/en-us/lib.../jj249318.aspx
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    I say you're crazy not to!
    --------------------------------------------------------------------------------------------------
    For health reasons i try to avoid reading unformatted Code

  6. #6

    Thread Starter
    Member kutlesh's Avatar
    Join Date
    Jun 2018
    Location
    Skopje, R. Macedonia
    Posts
    49

    Re: Monitoring writing data to xls file with VBA?

    Hmm, is ADO same as ADODB in Access 2016 VBA?

    I have Microsoft ActioveX Data Objects 2.8 included.

    Because I don't see the event ExecuteComplete in ADODB.Connection.

  7. #7
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    1,435

    Re: Monitoring writing data to xls file with VBA?

    You have to declare your Variable WithEvents
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    I say you're crazy not to!
    --------------------------------------------------------------------------------------------------
    For health reasons i try to avoid reading unformatted Code

  8. #8
    PowerPoster
    Join Date
    Dec 2004
    Posts
    23,729

    Re: Monitoring writing data to xls file with VBA?

    You have to declare your Variable WithEvents
    there is some basic example here
    http://vbadud.blogspot.com/2008/12/h...n-ado-vba.html
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  9. #9

    Thread Starter
    Member kutlesh's Avatar
    Join Date
    Jun 2018
    Location
    Skopje, R. Macedonia
    Posts
    49

    Re: Monitoring writing data to xls file with VBA?

    Mm, I see. If I add the WithEvents keyword, it populates the field in those two event bars above the code section. Nice!

Tags for this Thread

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width