re-post: custom button in custom toolbar

S

stef

OL 2002 SP3
Win XP HE SP1

Follow-up to: microsoft.public.outlook

Hi,
How do I create a custom button for a customized search I have saved as
..oss, in a new custom toolbar I have created for that purpose/or just as
an addition to the regular toolbar?
Tx a lot.
 
G

Guest

Paste this code into the top of a new module in the Outlook VBA editor:

Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String _
, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal
nShowCmd As Long) As Long
Public Const conSwNormal = 1

Sub RunSavedSearch()
ShellExecute 0, "open", "C:\Temp\test.oss", vbNullString, "", conSwNormal
End Sub

This will run the saved search file called "test.oss" in your C:\Temp
folder. Then map the RunSavedSearch macro to your custom toolbar button via
the Customize dialog (click Macros in the Categories list of the Commands tab
to see your macros).
 
S

stef

Eric said:
Paste this code into the top of a new module in the Outlook VBA editor:

Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String _
, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal
nShowCmd As Long) As Long
Public Const conSwNormal = 1

Sub RunSavedSearch()
ShellExecute 0, "open", "C:\Temp\test.oss", vbNullString, "", conSwNormal
End Sub

This will run the saved search file called "test.oss" in your C:\Temp
folder. Then map the RunSavedSearch macro to your custom toolbar button via
the Customize dialog (click Macros in the Categories list of the Commands tab
to see your macros).
That's great Eric. Let me try it as you have described and I'll post
the results here soon.
 
S

stef

Eric said:
Paste this code into the top of a new module in the Outlook VBA editor:

Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String _
, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal
nShowCmd As Long) As Long
Public Const conSwNormal = 1

Sub RunSavedSearch()
ShellExecute 0, "open", "C:\Temp\test.oss", vbNullString, "", conSwNormal
End Sub

This will run the saved search file called "test.oss" in your C:\Temp
folder. Then map the RunSavedSearch macro to your custom toolbar button via
the Customize dialog (click Macros in the Categories list of the Commands tab
to see your macros).

Eric, let me as u this: is it possible to add to or modify the code so
that it will extract the line that is in the subject of whatever email
is selected in whatever folder, e.g. Inbox or Sent, etc.?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top