# Outlook ActiveExplorer() - working vba to powershell

**URL:** <https://forums.powershell.org/t/outlook-activeexplorer-working-vba-to-powershell/14613>\
**Category:** PowerShell Help\
**Created:** [July 1, 2020, 12:13am UTC](https://forums.powershell.org/t/outlook-activeexplorer-working-vba-to-powershell/14613 "2020-07-01T00:13:49Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![artefact-fr](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@artefact-fr](https://forums.powershell.org/u/artefact-fr)\
**Post date:** [July 1, 2020, 12:13am UTC](https://forums.powershell.org/t/outlook-activeexplorer-working-vba-to-powershell/14613/1 "2020-07-01T00:13:49Z")

</div>

Hi Community,

I please just need to transpose a working vba code to powershell but I fail doing this.

Synopsys : Change Outlook active explorer folder with powershell.

I really need to interact with active explorer of active window because after creating a new contact adress book the window don’t refresh and don’t set the focus on the new adress book.

thanks

Example of Working VBA to adapt in powershell :

Sub ChangeCurrentFolder()  
Dim myNamespace As Outlook.NameSpace  
Set myNamespace = Application.GetNamespace(“MAPI”)  
Set Application.ActiveExplorer.CurrentFolder = myNamespace.GetDefaultFolder(olFolderCalendar)  
End Sub

---

<div class="post-metadata">

**Author:** ![artefact-fr](https://avatars.discourse-cdn.com/v4/letter/a/b782af/32.png) [@artefact-fr](https://forums.powershell.org/u/artefact-fr)\
**Post date:** [July 1, 2020, 6:33am UTC](https://forums.powershell.org/t/outlook-activeexplorer-working-vba-to-powershell/14613/2 "2020-07-01T06:33:15Z")

</div>

Sorry, I think I found …

Working outlook powershell to refresh Contact folder :

$RefreshContactFolderName = “TEST” # Must be a real outlook contact folder

$Outlook = New-Object -ComObject Outlook.Application  
$ContactFolder = $Outlook.Session.GetDefaultFolder(10).Folders.Item($RefreshContactFolderName)

$Outlook.ActiveExplorer().CurrentFolder = $ContactFolder

&nbsp;

&nbsp;

&nbsp;

&nbsp;

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:29pm UTC](https://forums.powershell.org/t/outlook-activeexplorer-working-vba-to-powershell/14613/3 "2024-05-16T20:29:16Z")

</div>

Closed on May 16, 2024, 8:29pm UTC


