Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50068

shared folder outlook vba

$
0
0
Hello,

Is there any way I can apply the code below to a shared sub folder in outlook? It works for my personal box but not for shared folders. The location of the folder shared sub folder is \\simon.barnes@siemens.com\Managed Folders\Archive\UK & Ireland. It's called "controls".

Code:


Private WithEvents oItems As Outlook.Items
 
Private Sub Application_Startup()
  Const MyFolder = "Controls" ' <-- Change to suit
  On Error Resume Next
  With Application.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox)
    Set oItems = .Folders(MyFolder).Items
    If Err Then
      .Folders.Add MyFolder
      Set oItems = .Folders(MyFolder).Items
    End If
  End With
  On Error GoTo 0
End Sub
 
Private Sub oItems_ItemAdd(ByVal Item As Object)
  Static N
  If IsNumeric(N) Then N = N + 1
  N = InputBox("Type ID to be added to the end of the Subject", "Subject ID", N)
  With Item
    .Subject = .Subject & " " & N
    .Save
  End With
End Sub


Viewing all articles
Browse latest Browse all 50068

Trending Articles