|
-
Mar 19th, 2006, 11:40 AM
#1
Thread Starter
New Member
How to open Outlook form with VB code
Hi,
I have an Outlook public form that I want to open with VB code.
I've found here the next script, but I don't know what's the path to the form (I choose it from organizational forms library).
How can I found out the path? Is there another way to do it?
VB Code:
Private Sub Command1_Click()
Dim oApp As Outlook.Application
Dim oMsg As Outlook.MailItem
Set oApp = New Outlook.Application
Set oMsg = oApp.CreateItemFromTemplate("D:\Development\Outlook\Outlook Template\Message Test.oft")
If Not oMsg Is Nothing Then
oMsg.Display vbModal
Else
MsgBox "Couldnt find your template!"
End If
oApp.Quit
Set oApp = Nothing
End Sub
-
Mar 20th, 2006, 04:29 AM
#2
Re: How to open Outlook form with VB code
I remember that code 
If you have a custom form that is not saved to the file system then you can create a new item in the folder that has that form as its default form. You can always .Move the item after if need be.
VB Code:
Dim oApp As Outlook.Application
Dim oMsg As Outlook.MailItem
Dim oFolder As Outlook.MAPIFolder
Set oApp = New Outlook.Application
Set oFolder = oApp.GetNamespace("MAPI").GetDefaultFolder(olFolderInbox).Folders("MySubFolderWithMyCustomForm")
Set oMsg = oFolder.Items.Add
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|