« first day (2308 days earlier)      last day (57 days later) » 

12:01 AM
[rubberduck-vba/examples] 1 closed issue.
[rubberduck-vba/Rubberduck] 1 opened issue. 1 closed issue. 11 issue comments.
[Minesweeper] Games Played: 134, Bombs Used: 77, Moves Performed: 17969, New Users: 55
1 hour later…
1:23 AM
A: Unable to capture AfterUpdate event with a custom event handler

user13557714Private WithEvents Control1 As MSForms.Control Will allow you to bind to events common to all controls: Enter, Exit, BeforeUpdate and AfterUpdate Correction. This does not work, and creates a run time error.

Wtf did I dream this working?
1:47 AM
A: Excel UserForm dynamic TextBox control exit events

Mathieu GuindonMSForms.Control defines the Enter and Exit events: if you need to handle TextBox.Change, then you need two WithEvents variables: Private WithEvents TextBoxEvents As MSForms.TextBox Private WithEvents ControlEvents As MSForms.Control Public Property Set Control(ByVal tb As Object) Set TextBo...

2:37 AM
Ooh I think I've found a little gem that's about to get a lot of attention
Someone got all the UserMemIds for all Control events
negative ids?
3:13 AM
And confirmed, it works! Woot!
we might need to start documenting those. i know Vb6 has a number of them but not very documented
A: Reducing WithEvent declarations and subs with VBA and ActiveX

EvROpen Notepad and copy code below and paste it in a new txt-file save it als CatchEvents2.cls VERSION 1.0 CLASS BEGIN MultiUse = -1 'True END Attribute VB_Name = "CatchEvents2" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_Pred...

3:48 AM
oh wow. they found the undocumented API entry for the Connect in VBS, it looks like
> This function is available through Windows XP and Windows Server 2003. In might be altered or unavailable in subsequent versions of Windows.
So far so good
yeah, nobody ain't touching that. At least as long an intern doesn't come along....
1 hour later…
5:21 AM
posted on September 30, 2020 by Rubberduck VBA

Using a WithEvents variable to handle the MSForms.Control events of, say, a TextBox control has the irritating tendency to throw a rather puzzling run-time error 459 “Object or class does not support the set of events”. To be honest, I had completely forgotten about this when I started working on this MVVM framework. I had… Continue reading Making MVVM Work in VBA Part 2: Even

7 hours later…
12:43 PM
This is cool: monster6502.com
1:33 PM
@BloggingDuck @MathieuGuindon great! FYI - your class module has the annotations for description but no anntotation for the usermemid? The attributes are there, though.
1:52 PM
Today's fun: Writing code for Excel, in Excel.
Also hey everyone
@Kaz #Why
^ this
@this I need to validate my inputs.
Specifically, I need to know that all the headers I'm expecting, are actually there.
And when you have 69 fields to validate it's a lot easier to just write the code in Excel via formula to declare the constants and put them into an iterable list, than type out 400 lines by hand.
(I actually have ~200 fields to validate across 5 input reports, but I'm just taking them one module at a time)
2:33 PM
@this gah, edited in Notepad++, and caught!
wait... I thought you did all your posting from your phone. Is there an Android version of NPP?
2:47 PM
grr, prettify is garbage
@FreeMan nah I just got something to work real quick and then immediately blogged about it and then realized I was missing a bunch of annotation comments so I added them in... after the fact... cheating a bit
@BloggingDuck @MathieuGuindon in your code you define constants for the MemIds, but don't actually use them?
the attributes still use (very) magic numbers
3:06 PM
Not sure how we'd use constants in the annotations/attributes...
3:25 PM
@this ah ok, didn't know if that was a thing, just saw they were unused.
If we did use it in code, then sure, we should be doing that. Would be interesting if RD can support named constants for annotations.
(because we need more complexity, right?)
3:48 PM
@BigBen, no, highlight.js is garbage. Prettify is good.
2 hours later…
6:05 PM
I tried the RubberDuck addin long time ago, but it was unusable: it was working only with very small projects, which is when you don't need it. My VBA projects are usually more than 30,000 lines, and the RubberDuck addin was chocking. Still, it doesn't solve the problem I'm asking about — stenci 18 mins ago
30,000 lines? yikes.
6:36 PM
The MVVM infrastructure code, including the unit tests and example, is currently 5,886 LoC across 81 modules, averaging 72 LoC / module. The initial parse completes in ~5 seconds on this machine.
turns out the better the code, the better RD works
I wouldn't be surprised if there were 100s of resolver ambiguities due to late-bound coding which adds to the performance. Mat's code probably avoids that as much as possible.
@MathieuGuindon True, but it's not a good sale for a product. "This punishes you brutally at first for being a nincompoop but you'll come to appreciate it."
lol yeah
Also "a refactoring tool but struggles with code that badly needs refactoring"
yeah not the best look
6:40 PM
Happy to take Stenci's performance-improving pull request any time
NP = O(MG)
Once VBA MVVM goes mainstream, that 30K LoC probably drops to 10K including half of it for the MVVM framework
Just take the example code's form / code-behind: how many lines would the equivalent functionality be with Smart UI instead of MVVM?
more importantly, how much easier to read the new code that only focus on business logic
6:48 PM
as opposed to figuring out what's the inputs and when it's read, etc. MyAnswer = Me.SomeRandomControl.Value is not as fun.
You're lucky it wasn't Me.TextBox183.Text
ooh, yeah, Lots of that in legacy codebase.
Public Sub CommandButton21_Click()
that grates my nerves and wears out my teeth
6:50 PM
But... it's not as bad as having MyWidget = Me.txtGadgets.Value
"WTF are we assigning gadgets to widgets?"
and let's not forget lovely snippets like lngFoo = "Bar"
3 hours later…
9:23 PM
OK, I have the super type names for document modules. Now, I just have to figure out why the type hierarchy pass does not recognize them.
9:33 PM
And done.
Now, I just have to figure out how to unit test this.
we don't mock the Com*** objects in the ComReflection currently, right?
Btw, what exactly was the reason all the relevant interfaces for document start with an underscore?
I would like to add a comment why I remove them for the supertypes.
Microsoft had 2 difference conventions. Half of them use _, other uses I
Hm, are there cases where we have to throw away the I in order to get the correct type?
isn't it the case the object implements both?
sometime they may make multiple interfaces for compatibility or something
9:37 PM
Excel sheets only implement _Worksheet.
But we only add Worksheet to our declarations.
don't you want to use the coclass?
That is not in the type library from the typeLib API.
I only get the ComInterface for the document module.
RE: _Worksheet - there is no IWorksheet
Anyway, from the document really can only implement the interface, not the coclass.
I know.
But I do not know about documents in the other hundreds of hosts for VBA.
correct, to determine the coclass, you'd have to find whether a coclass implements this interface. That implies making a dictionary for each interfaces of a coclass discovered.
The trouble, however, is that there is no guarantee that there will be only one coclass that implements this interface
9:42 PM
I wonder why we do not have the _Worksheet interface in the declarations, though.
I can't see it in OB but I can in oleview
if I can see it in oleview, it should be picked up when we parse the excel object library
It starts with an underscore; so it is hidden in the OB.
well, when I show the hidden members, I can see those with underscores.
just not the _Worksheet, oddly enough.
Regarding class -- apparently Wayne put in a helper function using a list of known identifiers: github.com/rubberduck-vba/Rubberduck/blob/…
which is convenient for popular document modules but as you said, not very helpful for other hosts.
Which interface should an Access report inherit?
all of the 3
9:55 PM
Are they all in the Access type library?
should be. why do you ask?
If you're worried about a version of the type library dropping a old version of interface, I don't think it'll ever happen. They just rename the current interface, hide the old interface which still has the same IID and keep it in the type library. I think it's a bad practice to drop an interface, even if it's never been supported for several versions.
I still wonder why we do not have a declaration for _Worksheet.
could it be that we are skipping over it by accident?
Hm, thinking about it, it would be confusing to the user to do this properly.
Technically, it is correct to say that Sheet1 does not implement Excel.Worksheet.
It only implements Excel._Worksheet, which is also implemented by Excel.Worksheet and contains all relevant information.
I still do not fully get what they did there with the document modules.
They seem to act like two concrete types at the same time.
?typeof Sheet1 is Excel.Worksheet
?typeof Sheet1 is Excel.[_Worksheet]
10:04 PM
How can you implement another class in COM? I thought you can only implement interfaces.
the first test is coclass, the 2nd test is interface
well, unless Excel.Worksheet implicitly maps to Excel.[_Worksheet]. They hide this details in VB world too good
Hm, how do you identify the coclass of an interface?
but anyway, I understood the document object to be basically a coclass that supports a code-behind (by providing for streams) and way to extend the behavior via events. So, a document object would be basically an extended version of the coclass.
?typeof sheet1 is Sheet1
?typeof sheet2 is Sheet1
In other words, how can i find out that an interface Sheet1 belongs to the coclass Excel.Worksheet.
27 mins ago, by this
correct, to determine the coclass, you'd have to find whether a coclass implements this interface. That implies making a dictionary for each interfaces of a coclass discovered.
There is no direct method for that information you're after.
10:09 PM
Can there be multiple coclasses implementing the interface?
and even using a dictionary approach, you have no guarantee that there's only one coclass that implements this interface.
I have yet to see one, though but doesn't mean it won't happen
OK, for now, I think I will cheat.
Probably why Wayne cheated, too with the linked code I posted earlier.
I just do not get how they pulled it off that the type checks against the coclass work in VBA.
Might as well be that they cheated as well and used some convention.
yes - it's a bit annoying that MS went to so much of effort to hide all this details from VB developers but not have a obvious method in the type library API to get that information
for all I know, maybe all TypeOf does is just a IUnknown::QueryInterface, passing in the IIDs, so Excel.Worksheet is actually referencing the Excel.[_Worksheet]'s IID which returns True even though Excel.Worksheet is an coclass, not an interface.
I believe Sheet1 and Sheet2 also get their own interfaces, too.
10:20 PM
They have their own interfaces, which both implement _Worksheet.
Stupid question: do reports and forms in Access appear in the VBE at all?
10:53 PM
@M.Doerner if they have modules, yes
I have never worked with forms and reports in Access. How do I add modules to them?
Another question: where exactly do I have to put the default values for the inspection type and severity?
@M.Doerner two ways: 1) add an event procedure via the properties sheet' Events tab using [Event Procedure] and then clicking on the ... button, 2) set its HasModule property to Yes in the Other tab in the property sheet.
Thanks! I will use that to test the document discovery for them.
note that Access has the unusual conventions where all forms' class module must be prefixed Form_xxx and reports, Report_xxx. Access will not allow imports of non document modules that contains the prefixes (and also certain class names like DoCmd)
an Access form with no module would implement only the Access.Form but an Access form with module would be Form_Form1 and Access.Form both
11:52 PM
@MathieuGuindon I have two comments regarding your latest blog post.
What you implemented for the event propagation is literally the observer pattern.
You could use member attribute annotations for the UserMemId attributes.

« first day (2308 days earlier)      last day (57 days later) »