![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
#1
|
|||
|
|||
![]()
In Outlook 2003 I have added a custom button to the tool-bar which
runs some VBA code so that the user can save an email as a .msg file to disk. What I want to do is - when the user clicks the button is to open the standard Office File Selector dialog form so that the user can then save the email file to a location of their choice. Does anyone have some code to open a dialog and return the full pathname and filename that the user selects. I don't really want to have to create a new form in Outlook just for this. Peter Hibbs. |
Ads |
#2
|
|||
|
|||
![]()
That dialog isn't available from Outlook. You can automate it by setting up
automation for Word or Excel or some other app that does expose that dialog. You could also use the Win32 API common dialog from VBA code, but that's somewhat more difficult to work with. There are samples for using the common dialog from VB6, which would be almost identical to using it from VBA, at www.vbaccelerator.com. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Professional Programming Outlook 2007. Reminder Manager, Extended Reminders, Attachment Options. http://www.slovaktech.com/products.htm "Peter Hibbs" wrote in message ... In Outlook 2003 I have added a custom button to the tool-bar which runs some VBA code so that the user can save an email as a .msg file to disk. What I want to do is - when the user clicks the button is to open the standard Office File Selector dialog form so that the user can then save the email file to a location of their choice. Does anyone have some code to open a dialog and return the full pathname and filename that the user selects. I don't really want to have to create a new form in Outlook just for this. Peter Hibbs. |
#3
|
|||
|
|||
![]()
Thanks Ken. As you say, the code on the VB6 Web site is more complex
than I want to get into for this project. I will have to think of some other way to do what I want. Peter Hibbs. On Tue, 18 Aug 2009 10:08:57 -0400, "Ken Slovak - [MVP - Outlook]" wrote: That dialog isn't available from Outlook. You can automate it by setting up automation for Word or Excel or some other app that does expose that dialog. You could also use the Win32 API common dialog from VBA code, but that's somewhat more difficult to work with. There are samples for using the common dialog from VB6, which would be almost identical to using it from VBA, at www.vbaccelerator.com. |
#4
|
|||
|
|||
![]()
Use:
Function GetCurrentItem() As Object On Error Resume Next Select Case TypeName(Outlook.ActiveWindow) Case "Explorer" Set GetCurrentItem = Outlook.ActiveExplorer.Selection.Item(1) Case "Inspector" Set GetCurrentItem = Outlook.ActiveInspector.CurrentItem Case Else End Select End Function Sub savemailitem() Dim objitem As Object Set objitem = GetCurrentItem() If objitem.Class = 43 Then SendKeys "%fa" End If End Sub -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "Peter Hibbs" wrote in message ... Thanks Ken. As you say, the code on the VB6 Web site is more complex than I want to get into for this project. I will have to think of some other way to do what I want. Peter Hibbs. On Tue, 18 Aug 2009 10:08:57 -0400, "Ken Slovak - [MVP - Outlook]" wrote: That dialog isn't available from Outlook. You can automate it by setting up automation for Word or Excel or some other app that does expose that dialog. You could also use the Win32 API common dialog from VBA code, but that's somewhat more difficult to work with. There are samples for using the common dialog from VB6, which would be almost identical to using it from VBA, at www.vbaccelerator.com. |
#5
|
|||
|
|||
![]()
Doug,
Thanks for the code, I will have a play with it and see if will do what my client wants. Peter Hibbs. On Thu, 20 Aug 2009 17:36:12 +1000, "Doug Robbins - Word MVP" wrote: Use: Function GetCurrentItem() As Object On Error Resume Next Select Case TypeName(Outlook.ActiveWindow) Case "Explorer" Set GetCurrentItem = Outlook.ActiveExplorer.Selection.Item(1) Case "Inspector" Set GetCurrentItem = Outlook.ActiveInspector.CurrentItem Case Else End Select End Function Sub savemailitem() Dim objitem As Object Set objitem = GetCurrentItem() If objitem.Class = 43 Then SendKeys "%fa" End If End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
OPEN DIALOG BOX ERROR | TORLAV | Outlook - General Queries | 9 | April 21st 08 05:45 PM |
OPEN DIALOG BOX | TORLAV | Outlook - Installation | 3 | March 31st 08 05:41 PM |
what is an open dialog box | Maineiac | Outlook - General Queries | 2 | July 6th 07 08:27 PM |
Change the phone selector fields on open | kghammond | Outlook - Using Forms | 0 | May 23rd 07 06:57 PM |
pst file option missing under new outlook data file dialog | UncleBuckle | Outlook - Installation | 2 | February 25th 06 12:49 AM |