using send keys in outlook

PacVII

New Member
Joined
Jul 20, 2017
Messages
22
Office Version
  1. 365
My latest project has me looking to try and get a count from a mailbox I am delegated for access on. Since I am not able to add in the mailbox to my profile (do not have full access) and have listed on the left side of the Outlook screen I need to go into File option, Open & Export, Other Users Folders to open the other person inbox. I was trying to see if I could use a VBA for this and pull back data on the mailbox. Since I don’t have the users inbox listed on the profile and I cannot find a ‘fast path’ way to opening this option I was going to use Send Key. However I cannot seem to get the Send Keys to work in outlook. Anyone have any ideas on this? Here is the code I have started but get an error, Run-time error 438, object doesn’t support the property or method. Is it possible to use Send Keys or can I use another method to get the user inbox opened?

Sub sendkey()


Dim objOutlook As Object
Dim objnSpace As Object
Set objOutlook = CreateObject("Outlook.Application")
Set objnSpace = objOutlook.GetNamespace("MAPI")

objOutlook.SendKeys "%{F}"


End Sub
 

Excel Facts

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.
I gave up on the send key option and now trying to use another option to open a default folder. Not having any luck with this either.
Dim objOutlook As Object, objnSpace As Object, objFolder As Object
Dim EmailCount As Integer
Dim AttCount As Integer
Set objOutlook = CreateObject("Outlook.Application")
Set objnSpace = objOutlook.GetNamespace("MAPI")
On Error Resume Next
Set objFolder = objnSpace.GetSharedDefaultFolder("user.name@any.com").Folders("inbox")
If Err.Number <> 0 Then
Err.Clear
MsgBox "No such folder."
Exit Sub
End If
 
Upvote 0

Forum statistics

Threads
1,214,431
Messages
6,119,462
Members
448,899
Latest member
maplemeadows

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top