The code below adds a menu item Custom1 right before New.... How can I get the keyboard shortcut assigned to CodeCustom1 (via Application.OnKey) to appear nicely right-aligned with Ctrl+N?
Sub menuItem_Create()
With CommandBars("Worksheet menu bar").Controls("File")
.Controls.Add(Type:=...
Set NewMenuItem = Toolsmenu.Controls.Add (Type:=msoControlButton) With NewMenuItem .Caption = "My special button" .ShortcutText = "Alt+R" .OnAction = "Macro1" End With
bah, I can live without keyboard shortcuts in the IDE.. would be nice to figure that out though
BTW the VBA code there is just to see pick the FaceID's - I'm actually doing this in C#, I'm rewriting my Assert class as a COM-visible ...hmm can I expose a static class to COM? so many things I've never done before....
well for the static Assert class I think I'll make a "New test class" menu, that will add a class module and add code to create the AssertClass instance, conveniently called Assert - how's that?
@Mat'sMug when you right click the Solution in VS - select Properties, on the left hand side there is a Debug tab and you can select the external application there
Nope. I'm not using the Excel object model for anything other than accessing the Application class; that using aliases the Excel.Application class with Excel as a convenient shortcut. If that's the class I need to cast the incoming Application parameter to, all is good. You know you can use using to alias a class, not just a namespace :)
@Mat'sMug I may have missed something here but it seems to me like if you were trying to cast Microsoft.Vbe.Interop.Vbe to Microsoft.Office.Interop.Excel.Applicaton?
In the excel vba sub below i need to insert the number of rows equal to variable j after row equal to k. So if J=17 and k=2 then i want 17 empty rows after row 2.
The code below is inserting the empty rows (j=17) however it is starting on row 17. How can i start on row equal k?
sub stuck()
Dim w...
In the process of trying to build a serializable data structure, I found myself building large strings, which gets very slow because VBA copies a string every time concatenation is performed.
To alleviate this, referring to Dynamic Array and Java's StringBuilder interface, I cobbled together a u...
I have a JSON parser I'd love advice on - especially if @Mat'sMug can give me pointers on coding style (I'm generally the only consumer of my code, so I get extremely lazy), but as my first gentle introduction to CodeReview, I posted a StringBuilder class that's used by the JSON parser.
First, you need to add a reference to the Microsoft Visual Basic for Applications Extensibility 5.3 library.
Click Tools>>References>> Microsoft Visual Basic for Applications Extensibility 5.3
Then you need to open the workbook containing the module you want to update. This means that you c...
Private Type TLogManager
Formatter As ILogMessageFormatter
Loggers As New Dictionary
End Type
Private this As TLogManager
Public Property Get Formatter() As ILogMessageFormatter
Set Formatter = this.Formatter
End Property
Public Property Set Formatter(ByVal value As ILogMessageFormatter)
Set this.Formatter = value
End Property
In fact, I'll have to post the TAR classes I wrote up on CR - it's a limited subset of the Tape ARchive specification that generates container files you can actually open with WinZip. It's a good example of the Type export/import behavior
I've done some digging around and the answer is no. You can not set a default value in the signature line because it expects a constant expression. All you can do is check to see if the variant is missing. I suppose you could fake an overload with a second function, but that seems convoluted. — RubberDuck1 min ago
OP wants to set a default value for an optional array parameter.