Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Programming Forms / March 2006

Tip: Looking for answers? Try searching our database.

VBA shortcut to open custom form in design mode?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Burma Jones - 04 Mar 2006 03:59 GMT
There is a custom form that I modify frequently and I was wondering if there is any way to programmatically open the form in design mode?  Currently I have to go Tools -> Forms -> Design a Form -> Personal Forms Library -> select the form (or double-click) -> Open

Thanks
Hollis D. Paul - 04 Mar 2006 16:15 GMT
> There is a custom form that I modify frequently and I was wondering
> if there is any way to programmatically open the form in design
> mode?  Currently I have to go Tools -> Forms -> Design a Form ->
> Personal Forms Library -> select the form (or double-click) -> Open

Well, you can certainly write VBA code to open the form.  That would
get half the process done.

Sub SharePointTips()
   'Declarations
   Dim myItem As ContactItem
   Dim myMailItem As MailMessage
   Dim myRecip As Recipient
   Dim myOlApp As New Outlook.Application
   Dim myOlNS As NameSpace
   Dim myOlfldr As MAPIFolder
   Dim myOlExp As Outlook.Explorer
   
       Set myOlExp = myOlApp.ActiveExplorer
       Set myOlNS = myOlApp.GetNamespace("MAPI")
       Set myOlfldr = myOlNS.GetDefaultFolder(olFolderContacts)
       
       Set myItem = myOlfldr.Items.Add("IPM.Contact.SharePointTips_Q")
       myItem.Display
       
       Set myRecip = Nothing
       Set myMailItem = Nothing
       
       
   'free variables
   Set myItem = Nothing
   Set myOlNS = Nothing
   Set myOlfldr = Nothing
   Set myOlApp = Nothing
   Set myOlExp = Nothing

End Sub

Put it in the ThisOutlook module.  Change the names to reflect your
system.

Hollis D. Paul [MVP - Outlook]
Mukilteo, WA  USA

Burma Jones - 06 Mar 2006 19:17 GMT
What I ended up doing is to use an AutoIT script to do a Sendkeys action:

Sub DesignCustomForm()

Dim RetVal

RetVal = Shell("""C:\Program Files\AutoIt3\AutoIt3.exe"" ""C:\DesignCustomForm.au3""")
SendKeys "%(tfe)"

End Sub

AutoIT script (DesignCustomForm.au3):

WinWaitActive("Design Form")
Opt("SendKeyDelay", 200)
Send("{DOWN}")
Send("{ENTER}")
Exit
 There is a custom form that I modify frequently and I was wondering if there is any way to programmatically open the form in design mode?  Currently I have to go Tools -> Forms -> Design a Form -> Personal Forms Library -> select the form (or double-click) -> Open

 Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.