Skip to content

Commit ccd6225

Browse files
committed
Merge pull request #1707 from ThunderFrame/next
Adds Unit Tests to Outlook
2 parents b96664e + 6ac1979 commit ccd6225

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

RetailCoder.VBE/UI/Command/AddTestModuleCommand.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ public override bool CanExecute(object parameter)
3232
}
3333

3434
// Outlook requires test methods to be located in [ThisOutlookSession] class.
35-
return app.ApplicationName != "Outlook";
35+
//return app.ApplicationName != "Outlook";
36+
return true;
3637
}
3738

3839
public override void Execute(object parameter)

Rubberduck.VBEEditor/VBEHost/OutlookApp.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using System;
22
using System.Runtime.InteropServices;
3-
//using Microsoft.Office.Interop.Outlook;
3+
using Microsoft.Office.Core;
4+
using Microsoft.Office.Interop.Outlook;
45

56
namespace Rubberduck.VBEditor.VBEHost
67
{
@@ -23,7 +24,18 @@ public override void Run(QualifiedMemberName qualifiedMemberName)
2324
//taskitem.Subject = "Rubberduck";
2425
//taskitem.Body = qualifiedMemberName.MemberName;
2526

26-
throw new NotImplementedException();
27+
try
28+
{
29+
var app = Application;
30+
var exp = app.ActiveExplorer();
31+
CommandBar cb = exp.CommandBars.Add("RubberduckCallbackProxy", Temporary: true);
32+
CommandBarControl btn = cb.Controls.Add(MsoControlType.msoControlButton, 1);
33+
btn.OnAction = qualifiedMemberName.ToString();
34+
btn.Execute();
35+
cb.Delete();
36+
}
37+
catch {
38+
}
2739
}
2840
}
2941
}

0 commit comments

Comments
 (0)