+ Reply to Thread
Results 1 to 23 of 23

I need the VBA message box should open and close automatically while macro is running

  1. #1
    Forum Contributor
    Join Date
    08-15-2016
    Location
    Chennai
    MS-Off Ver
    MS2013
    Posts
    159

    I need the VBA message box should open and close automatically while macro is running

    I am using the below code to receive the output from DB. The code will take the data from DB and keep in Excel sheet.
    I need the VBA message box should open and close automatically while macro is running.Please help me to solve this.


    Please Login or Register  to view this content.
    Last edited by Prabakaran3003; 06-08-2017 at 06:40 AM.

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: I need the VBA message box should open and close automatically while macro is running

    What do you mean by "while the macro is running"? What information do you want to display in the message box? At what point(s) in execution do you want it to appear?
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Forum Contributor
    Join Date
    08-15-2016
    Location
    Chennai
    MS-Off Ver
    MS2013
    Posts
    159

    Re: I need the VBA message box should open and close automatically while macro is running

    Hi,

    While code is running (means while copying the data from DB to Excel) during that period just want to display a msg box which shows "processing !! please wait"
    kind of thing. it would be good if it is open and close repeatedly.

  4. #4
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: I need the VBA message box should open and close automatically while macro is running

    You can't use a MsgBox so you have to:

    Create a UserForm and format it for how you want it to look (let's say it's called UserFormNotify)
    Set the ShowModal property to False
    In your code, just before each database transaction, add

    Please Login or Register  to view this content.
    then after the transaction

    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    08-15-2016
    Location
    Chennai
    MS-Off Ver
    MS2013
    Posts
    159

    Re: I need the VBA message box should open and close automatically while macro is running

    HI ,

    I am getting an error "cant show non modal form when modal form is displayed".

  6. #6
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: I need the VBA message box should open and close automatically while macro is running

    The sub you showed is called PIN_Click(). Is this for a button on a userform?

    Another way to do it is to show a message on the existing form, rather than bring up a new form.

    Because of the interaction among forms it would be easier to help if you attach your file.

  7. #7
    Forum Contributor
    Join Date
    08-15-2016
    Location
    Chennai
    MS-Off Ver
    MS2013
    Posts
    159

    Re: I need the VBA message box should open and close automatically while macro is running

    Hi.. that is a button and not a userform.
    I can't attach the attachment since you can't see the results from your system.. how to show the message from existing form.. am expecting the message box to be appear in every 2 secs gap...
    Last edited by Prabakaran3003; 06-08-2017 at 02:03 PM.

  8. #8
    Forum Contributor
    Join Date
    08-15-2016
    Location
    Chennai
    MS-Off Ver
    MS2013
    Posts
    159

    Re: I need the VBA message box should open and close automatically while macro is running

    Anyone.. please help on this...

  9. #9
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: I need the VBA message box should open and close automatically while macro is running

    Can you provide a sample workbook to look at?
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  10. #10
    Forum Contributor
    Join Date
    08-15-2016
    Location
    Chennai
    MS-Off Ver
    MS2013
    Posts
    159

    Re: I need the VBA message box should open and close automatically while macro is running

    Hi Arkadi...

    I have attached the sheet here. i have given the database strings over there... you can only see the code..

    Code is available from Userform Called PIN. please help me to solve that.
    Attached Files Attached Files

  11. #11
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: I need the VBA message box should open and close automatically while macro is running

    Hello Prabakaran3003,

    You also need to upload the "C:\Test data.xlsx" Workbook.

    Regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  12. #12
    Forum Contributor
    Join Date
    08-15-2016
    Location
    Chennai
    MS-Off Ver
    MS2013
    Posts
    159

    Re: I need the VBA message box should open and close automatically while macro is running

    Hi,

    I have uploaded the required workbook. Thanks!!

    Regards,
    Praba
    Attached Files Attached Files

  13. #13
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: I need the VBA message box should open and close automatically while macro is running

    I should add that:

    Please Login or Register  to view this content.
    Essentially opens the recordset twice.. you don't need the
    Please Login or Register  to view this content.
    since you earlier in the code set the rs object, and have opened it with rs.Open....

  14. #14
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: I need the VBA message box should open and close automatically while macro is running

    Ok, try making a form called UserNotify, with the message you want displayed, and give this a go.


    Please Login or Register  to view this content.

  15. #15
    Forum Contributor
    Join Date
    08-15-2016
    Location
    Chennai
    MS-Off Ver
    MS2013
    Posts
    159

    Re: I need the VBA message box should open and close automatically while macro is running

    Hi.. I just tried with this... It is showing cant show non modal form when modal form is displayed.

  16. #16
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: I need the VBA message box should open and close automatically while macro is running

    Are you sure you used the code I posted? I know someone suggested something like this and you tried that version, but mine hides the modal form first and it seemed to work on my end?

  17. #17
    Forum Contributor
    Join Date
    08-15-2016
    Location
    Chennai
    MS-Off Ver
    MS2013
    Posts
    159

    Re: I need the VBA message box should open and close automatically while macro is running

    Now am getting below error too
    Attached Files Attached Files

  18. #18
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: I need the VBA message box should open and close automatically while macro is running

    In the UserForm Editor, you need to change the ShowModal property of your original form as False (modeless).

  19. #19
    Forum Contributor
    Join Date
    08-15-2016
    Location
    Chennai
    MS-Off Ver
    MS2013
    Posts
    159

    Re: I need the VBA message box should open and close automatically while macro is running

    Hey arkadi, yeah i tried code given by you... it was not working.. i dint change anything on that..

  20. #20
    Forum Contributor
    Join Date
    08-15-2016
    Location
    Chennai
    MS-Off Ver
    MS2013
    Posts
    159

    Re: I need the VBA message box should open and close automatically while macro is running

    Hey 6StringJazze,

    Are you saying solution for this one "SQL0420N Invalid character found in a character string argument of the function "DECFLOAT""??

  21. #21
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: I need the VBA message box should open and close automatically while macro is running

    My response was that you were getting an error that you could not display a modeless form when a modal form is displayed. However, I responded before I saw post #16, which seems to answer it.

  22. #22
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: I need the VBA message box should open and close automatically while macro is running

    Hello Prabakaran3003,

    I do not have Excel 2013, and cannot Test the attached sample. Please see if you can make do with it.

    Regards.
    Attached Files Attached Files

  23. #23
    Forum Contributor
    Join Date
    08-15-2016
    Location
    Chennai
    MS-Off Ver
    MS2013
    Posts
    159

    Re: I need the VBA message box should open and close automatically while macro is running

    Thank you wilson. since i am not able to verify it because of getting an another issue.surely i come back to you once i tested your code.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA message box should open and close automatically while macro is running
    By Prabakaran3003 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-08-2017, 08:58 AM
  2. [SOLVED] Issue with Open, copy, close Macro - when trying to close workbook Clipboard error
    By seanpcorbett1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-13-2016, 05:14 PM
  3. [SOLVED] Automatically open, close & saved documents
    By namialus in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-24-2014, 08:48 PM
  4. Replies: 0
    Last Post: 10-02-2013, 01:47 AM
  5. [SOLVED] Automatically open and close spreadsheets on Google drive
    By judy hess in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-22-2013, 03:35 PM
  6. [SOLVED] Open file --> have pop up message appear --> click on pop up to close it
    By debbiesh in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 05-23-2012, 09:28 AM
  7. Open and Close Excel / Time Running
    By tchristie33 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-08-2007, 09:13 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1