|
-
Nov 11th, 2010, 11:42 AM
#1
Thread Starter
Frenzied Member
Prevent user clicking in excel while processing
I am using VSTO and have excel to run reports.
The code uses a background worker process to retrieve the data while a timer runs in the main thread.
However this all works ok onluss the user opens a dialogue window for example something from the menu bar. If the user does this then the sheet doesnt have the focus and causes an error when it comes to draw the data on the sheet.
Is there any way to prevent users from clicking things while the system is busy.
I manually change the cursor to an hourglass but that doesnt prevent the clicking.
Can anyone think of a way to handle this?
-
Nov 12th, 2010, 02:43 AM
#2
Re: Prevent user clicking in excel while processing
change the excel process to not visible for the duration?
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
-
Nov 12th, 2010, 04:17 AM
#3
Thread Starter
Frenzied Member
Re: Prevent user clicking in excel while processing
Im not sure I understand what you mean, the excel process runs in the main thread, I need the excel shhet to be visible to display the timer to the user while the query is executing in the other thread, providing this would be unnaffected how would I make the process not visible?
-
Nov 12th, 2010, 06:12 AM
#4
Re: Prevent user clicking in excel while processing
application.visible = false
where application is you excel object
if you are running multiple instances of excel you can hide one or more
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
-
Nov 12th, 2010, 07:06 AM
#5
Thread Starter
Frenzied Member
Re: Prevent user clicking in excel while processing
But that makes the application invisible so the user will not be able to see anything including the work sheet and timer incrementing.
I only really want to prevent them clicking on menu items when the wait cursor is busy.
-
Nov 12th, 2010, 08:01 AM
#6
Re: Prevent user clicking in excel while processing
turn of the menu and toolbars? but they can still right click
i don't think you can stop them using menu items
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
-
Nov 15th, 2010, 04:57 PM
#7
Re: Prevent user clicking in excel while processing
FishGuy... not sure if this will help you?
Code:
Private Declare Function ShowCursor& Lib "user32" (ByVal bShow As Long)
Sub ShowHideCursor()
ShowCursor (False)
'~~> Your Code
ShowCursor (True)
End Sub
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|