Jamie graciously offered to share his popup menu classes with the world.
Download PopupMenu.zip
Thanks, Jamie.
Jamie graciously offered to share his popup menu classes with the world.
Download PopupMenu.zip
Thanks, Jamie.
Posting code? Use <pre> tags for VBA and <code> tags for inline.
Jamie
Nice work!
And great idea Juan Pablo González!
I have an immediate use for it.
Having just glossed the code, I see code for handling TreeView.
My solution would need it for a ListView control.
I presume adding another elseif in CPopupControlMSComctlLib.Init is necessary.
Again – good work. Very useful.
Cheers
Rob
“My solution would need it for a ListView control.”
Rob, You are correct. And you prompted me to recall (too late) I had used TypeName where TypeOf would be better. You’d also need a WithEvents variable to hold the reference and provide the event handler. So:
Private WithEvents m_ListView As MSComctlLib.ListView
…
If TypeOf Control Is MSComctlLib.TreeView Then
Set m_TreeView = Control
ElseIf TypeOf Control Is MSComctlLib.ListView Then
Set m_ListView = Control
Else
Exit Function
End If
Jamie.
I incorporates the code into my access 2000 vba project, but can’t get it to work with my treeview. It kicks up an error when trying to set m_treeview = control where my treeview is actually a “treectrl” and not a “treeview” so the types are different!
I’m trying to find a genuine “treeview” to put into my project, in place of the treectrl from the mscomctllib v6 and have referenced the v5 treeview, but can’t seem to insert the activex into my project.
I exported and imported everything including the form into access and made several minor changes (including removing the textbox references) so that my objects were referenced instead.
I can’t even seem to get the genuine treeview from the imported form onto my access form (which appears to be a different kind of form altogether)
any ideas would be greatly appreciated.
It appears that although access application itself (outside vba) recognises the treectrl as a “treectrl”, VBA tells me in the watch window that the TYPE of the object is “custom” – which it isn’t! I got it stright from the “insert activeX object” menu on the form designer.
I’m stuck!
thanks
Guy Carnegie
Okay, answered my own question. I had to type :
oControl.Init Xtree.Object
where I WAS typing…
oControl.Init Xtree
Everything is working well now and I’m well chuffed.
thanks
Guy