M
Morgan
ok I'm very new to programing in Outlook. I have a custom form with 3
command buttons on it and I want to use the GetPublicFolder() function but
not sure how to call the function for each button or if it needs to be
inside the Sub for each button see code below
Public Function GetPublicFolder()
Dim colFolders
Dim objFolder
Dim arrFolders
Dim i
On Error Resume Next
strFolderPath = Replace(strFolderPath, "/", "\")
arrFolders = Split(strFolderPath, "\")
Set objFolder = Application.Session.GetDefaultFolder(18)
Set objFolder = objFolder.Folders.Item(arrFolders(0))
If Not objFolder Is Nothing Then
For i = 1 To UBound(arrFolders)
Set colFolders = objFolder.Folders
Set objFolder = Nothing
Set objFolder = colFolders.Item(arrFolders(i))
If objFolder Is Nothing Then
Exit For
End If
Next
End If
Set GetPublicFolder = objFolder
Set colFolders = Nothing
Set objApp = Nothing
Set objFolder = Nothing
End Function
'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
'ZZ need to call public function GetPublicFolder() ZZZ
'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
'Action and call for Create Contact History
Sub creathist_Click()
'need to assign projourn as default form
GetPublicFolder(Public Folders\All Public Folders\Construction\Project
Jornals\)
MsgBox "This will open Project Journals"
End Sub
'Action and call for Create Task
Sub CommandButton4_Click()
'need to assign protask as default form
GetPublicFolder(Public Folders\All Public
Folders\Construction\construction\Project Task\)
MsgBox "This will open Project Task"
End Sub
'Action and call for Create Appt
Sub CommandButton3_Click()
'need to assign proappt as default form
GetPublicFolder(Public Folders\All Public
Folders\Construction\construction\Project Appointmenst and Dates\)
MsgBox "This will open Project Appointmenst and Dates"
End Sub
command buttons on it and I want to use the GetPublicFolder() function but
not sure how to call the function for each button or if it needs to be
inside the Sub for each button see code below
Public Function GetPublicFolder()
Dim colFolders
Dim objFolder
Dim arrFolders
Dim i
On Error Resume Next
strFolderPath = Replace(strFolderPath, "/", "\")
arrFolders = Split(strFolderPath, "\")
Set objFolder = Application.Session.GetDefaultFolder(18)
Set objFolder = objFolder.Folders.Item(arrFolders(0))
If Not objFolder Is Nothing Then
For i = 1 To UBound(arrFolders)
Set colFolders = objFolder.Folders
Set objFolder = Nothing
Set objFolder = colFolders.Item(arrFolders(i))
If objFolder Is Nothing Then
Exit For
End If
Next
End If
Set GetPublicFolder = objFolder
Set colFolders = Nothing
Set objApp = Nothing
Set objFolder = Nothing
End Function
'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
'ZZ need to call public function GetPublicFolder() ZZZ
'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
'ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
'Action and call for Create Contact History
Sub creathist_Click()
'need to assign projourn as default form
GetPublicFolder(Public Folders\All Public Folders\Construction\Project
Jornals\)
MsgBox "This will open Project Journals"
End Sub
'Action and call for Create Task
Sub CommandButton4_Click()
'need to assign protask as default form
GetPublicFolder(Public Folders\All Public
Folders\Construction\construction\Project Task\)
MsgBox "This will open Project Task"
End Sub
'Action and call for Create Appt
Sub CommandButton3_Click()
'need to assign proappt as default form
GetPublicFolder(Public Folders\All Public
Folders\Construction\construction\Project Appointmenst and Dates\)
MsgBox "This will open Project Appointmenst and Dates"
End Sub