Skip to content

Commit

Permalink
Merge pull request #1707 from ThunderFrame/next
Browse files Browse the repository at this point in the history
Adds Unit Tests to Outlook
  • Loading branch information
retailcoder committed Jun 5, 2016
2 parents b96664e + 6ac1979 commit ccd6225
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
3 changes: 2 additions & 1 deletion RetailCoder.VBE/UI/Command/AddTestModuleCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public override bool CanExecute(object parameter)
}

// Outlook requires test methods to be located in [ThisOutlookSession] class.
return app.ApplicationName != "Outlook";
//return app.ApplicationName != "Outlook";
return true;
}

public override void Execute(object parameter)
Expand Down
16 changes: 14 additions & 2 deletions Rubberduck.VBEEditor/VBEHost/OutlookApp.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Runtime.InteropServices;
//using Microsoft.Office.Interop.Outlook;
using Microsoft.Office.Core;
using Microsoft.Office.Interop.Outlook;

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

throw new NotImplementedException();
try
{
var app = Application;
var exp = app.ActiveExplorer();
CommandBar cb = exp.CommandBars.Add("RubberduckCallbackProxy", Temporary: true);
CommandBarControl btn = cb.Controls.Add(MsoControlType.msoControlButton, 1);
btn.OnAction = qualifiedMemberName.ToString();
btn.Execute();
cb.Delete();
}
catch {
}
}
}
}

0 comments on commit ccd6225

Please sign in to comment.