• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 534
  • Last Modified:

Lock screen or just outlook while performing VBA script

I have created a script in VBA in Outlook, that move mails to our DMS. The macro takes a while around 2-3 seconds per e-mail. I need somehow to prevent the user from clicking around in outlook while the macro is running. I tried displaying a form with the command FrmInfoFlyt.Show (vbModeless), but that doesn't help. Any ideas ?
0
Zoodiaq
Asked:
Zoodiaq
1 Solution
 
thydzikCommented:
try the following code, take from here
http://bytes.com/topic/access/answers/870290-disable-mouse-keyboard

tested working, alt-ctl-delete cancels the lock.
Public Declare Function BlockInput Lib "USER32.dll" (ByVal fBlockIt As Long) As Long



Private Sub ImpData_Click()
On Error GoTo Err_ImpData_Click
Dim intCounter As Long
 

 
BlockInput True
 
For intCounter = 1 To 2147000000
  'take a nap!
Next
 
BlockInput False
 
DoCmd.Hourglass False
 
Exit_ImpData_Click:
  Exit Sub
 
Err_ImpData_Click:
  BlockInput False
  DoCmd.Hourglass False
    MsgBox Err.Description, vbExclamation, "Error in Pic Names"
    Resume Exit_ImpData_Click
End Sub

Open in new window

0
 
ZoodiaqAuthor Commented:
Perfect, it works!!

thx.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now