M
marcbert
I have an issue:
I need to export all Outlook 2002 Shortcuts to a file. I have a piece
of code that will loop through all the shortcuts, and display them on
the screen.
When I get to some user defined shortcuts, which lead to local
locations ("C:\", "m:\documents", etc), it seems like the TARGET
property doesn't contain valid data. When I try to print to the
screen, I get an error.
So I decided to see what type the property is returning. When I do a
typename(objShortcut.Target), for all of the built-in shortcuts, a
type of "MAPIFolder" is returned, which is expected. A URL shortcut
will return type "String" which is fine. A shortcut the points to a
local location ("C:\") returns type "Object". I can't find any
information regarding what properties this "Object" supports. The
goal is, I need the program to return the path ("C:\") of this
object.... Source code is below.......
Sub ShowMyFolders()
On Error Resume Next
Dim objApp As Application
Dim objOB As OutlookBarPane
Dim objOBGroup As OutlookBarGroup
Dim objOBGroups As OutlookBarGroups
Dim objShortcut As OutlookBarShortcut
Dim colShortcuts As OutlookBarShortcuts
Dim objExpl As Explorer
Set objApp = CreateObject("Outlook.Application")
Set objOB = objApp.ActiveExplorer.Panes.Item("OutlookBar")
Set objOBGroups = objOB.Contents.Groups
MsgBox objOBGroups.Count
For Each objOBGroup In objOBGroups
MsgBox "**** " & objOBGroup.Name & " ****"
Set colShortcuts = objOBGroup.Shortcuts
For Each objShortcut In colShortcuts
MsgBox TypeName(objShortcut.Target)
If UCase(TypeName(objShortcut.Target)) = "OBJECT" Then
MsgBox "Name " & objShortcut.Name & vbCrLf & "Class " &
objShortcut.Class & vbCrLf & "Parent " & objShortcut.Parent & vbCrLf &
"Application " & objShortcut.Application & vbCrLf & "Session " &
objShortcut.Session
Else
MsgBox "Name " & objShortcut.Name & vbCrLf &
"Application " & objShortcut.Application & vbCrLf & "Class " &
objShortcut.Class & vbCrLf & "Parent " & objShortcut.Parent & vbCrLf &
"Session " & objShortcut.Session & vbCrLf & "Target " &
objShortcut.Target
End If
Next
Next
' release objects
Set objExpl = Nothing
Set objShortcut = Nothing
Set colShortcuts = Nothing
Set objOB = Nothing
Set objApp = Nothing
End Sub
I need to export all Outlook 2002 Shortcuts to a file. I have a piece
of code that will loop through all the shortcuts, and display them on
the screen.
When I get to some user defined shortcuts, which lead to local
locations ("C:\", "m:\documents", etc), it seems like the TARGET
property doesn't contain valid data. When I try to print to the
screen, I get an error.
So I decided to see what type the property is returning. When I do a
typename(objShortcut.Target), for all of the built-in shortcuts, a
type of "MAPIFolder" is returned, which is expected. A URL shortcut
will return type "String" which is fine. A shortcut the points to a
local location ("C:\") returns type "Object". I can't find any
information regarding what properties this "Object" supports. The
goal is, I need the program to return the path ("C:\") of this
object.... Source code is below.......
Sub ShowMyFolders()
On Error Resume Next
Dim objApp As Application
Dim objOB As OutlookBarPane
Dim objOBGroup As OutlookBarGroup
Dim objOBGroups As OutlookBarGroups
Dim objShortcut As OutlookBarShortcut
Dim colShortcuts As OutlookBarShortcuts
Dim objExpl As Explorer
Set objApp = CreateObject("Outlook.Application")
Set objOB = objApp.ActiveExplorer.Panes.Item("OutlookBar")
Set objOBGroups = objOB.Contents.Groups
MsgBox objOBGroups.Count
For Each objOBGroup In objOBGroups
MsgBox "**** " & objOBGroup.Name & " ****"
Set colShortcuts = objOBGroup.Shortcuts
For Each objShortcut In colShortcuts
MsgBox TypeName(objShortcut.Target)
If UCase(TypeName(objShortcut.Target)) = "OBJECT" Then
MsgBox "Name " & objShortcut.Name & vbCrLf & "Class " &
objShortcut.Class & vbCrLf & "Parent " & objShortcut.Parent & vbCrLf &
"Application " & objShortcut.Application & vbCrLf & "Session " &
objShortcut.Session
Else
MsgBox "Name " & objShortcut.Name & vbCrLf &
"Application " & objShortcut.Application & vbCrLf & "Class " &
objShortcut.Class & vbCrLf & "Parent " & objShortcut.Parent & vbCrLf &
"Session " & objShortcut.Session & vbCrLf & "Target " &
objShortcut.Target
End If
Next
Next
' release objects
Set objExpl = Nothing
Set objShortcut = Nothing
Set colShortcuts = Nothing
Set objOB = Nothing
Set objApp = Nothing
End Sub