Home > Enterprise >  How tor Run code on Outlook from Excel workbook?
How tor Run code on Outlook from Excel workbook?

Time:04-26

First, I am using a code on outlook to hide the mouse cursor on outlook before open the attached workbook:

Private Declare Function ShowCursor Lib "USER32" (ByVal fShow As Integer) As Integer             
Public Sub hide_Cursor()
  ShowCursor False
End Sub

After attached file is opened, I need to do the opposite (show the mouse cursor on outlook),
But, I did not find any events on outlook to run code after attachment file is opened.
So,I need the following code to be run from Excel workbook itself.
I tried to run it from excel but it has no effect (the mouse cursor still hidden on outlook) !

Private Declare Function ShowCursor Lib "USER32" (ByVal fShow As Integer) As Integer   
    Public Sub Show_Cursor()
      ShowCursor True
    End Sub

In advance,many thanks for any help.

CodePudding user response:

The ShowCursor function applies only to the process from which it was called. So, to get back the cursor you need to call the method from the Outlook process, not Excel.

  • Related