Skip to content

Commit 0bacf49

Browse files
committed
Adds DocumentName to QualifiedMember when used with Application.Run
Fixes #1804 without changing the ActiveProject. eg. `Application.Run("Book1.xlsm!VBAProject.TestModule1.TestMethod1")`
1 parent 6dc85aa commit 0bacf49

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

Rubberduck.VBEEditor/VBEHost/ExcelApp.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,14 @@ public ExcelApp(VBE vbe) : base(vbe, "Excel") { }
99

1010
public override void Run(QualifiedMemberName qualifiedMemberName)
1111
{
12-
Application.Run(qualifiedMemberName.ToString());
12+
string call = GenerateMethodCall(qualifiedMemberName);
13+
Application.Run(call);
14+
}
15+
16+
protected virtual string GenerateMethodCall(QualifiedMemberName qualifiedMemberName)
17+
{
18+
var documentName = qualifiedMemberName.QualifiedModuleName.ProjectDisplayName;
19+
return string.Concat(documentName, "!", qualifiedMemberName.ToString());
1320
}
1421
}
1522
}

0 commit comments

Comments
 (0)