Excel 2013 VBA to Outlook 2013 Paste clipboard to SQL Dasl filter in specific folder

Learnbuddy

New Member
Joined
Nov 25, 2015
Messages
5
Hello all,

I have created an Excel spreadsheet that works like this:

a user clicks a .VBS file which opens my Excel spreadsheet (which stays invisible) and runs a specific macro
a calendar pops up and the user clicks on a date
A particular column within the spreadsheets resets to default SQL statements I created
The new user selected date gets injected into those SQL statement
The SQL statements get copied onto the users clipboard.

After this the user manually opens Outlook, clicks on a particular search folder named "Virtual Inbox", opens the SQL filter dialog box, pastes the contents of their clipboard, clicks ok and clicks ok.

Their emails are then filtered to their desire.

I would like the manual steps automated with VBA. I am uncertain if this portion can be done in Excel 2013, or if it needs to be done in Outlook 2013 VBA. I was thinking I could add a quick access toolbar icon in Outlook that the user would click which would call my Excel Macro to copy the data in their clipboard, and then it would run an Outlook macro to paste it into the SQL filter box of the particular folder.

This part is more difficult for me because I haven't found a record macro button in Outlook 2013, so I'm unsure how to activate or call to the SQL filter box.

The attached or following image is does not contain my code, but is simply an image of the SQL filter box I am referring to.

figure_02.gif
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.

Learnbuddy

New Member
Joined
Nov 25, 2015
Messages
5
Update: 8/25/2016 21:16 CT.

I created the Outlook Macro that calls my VB script which copies the SQL code and added the macro to the quick access toolbar.

Sub RUNvbscript()

strPath = "H:\Outlook SQL Query\SQL Outlook 8-18-2016D2.vbs"
Set objShell = CreateObject("WScript.Shell")

objShell.Run Chr(34) & strPath & Chr(34), 1, False

End Sub



Next I need to figure out how to take that output (Contents of clipboard) and paste it into the SQL filter box. I have another quick access toolbar that takes me to the filter screen, so I'm looking for a way to call this other button from my new code above.
 

Forum statistics

Threads
1,143,660
Messages
5,720,137
Members
422,267
Latest member
olund

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top