<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://communities.bentley.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>[VBA] Right Click Popup Menu from Userform</title><link>https://communities.bentley.com/products/programming/microstation_programming/f/microstation-programming---forum/97593/vba-right-click-popup-menu-from-userform</link><description>A few years ago, at my previous employer, I built a VBA macro that had a Right Click Copy/Paste menu for text boxes. Unfortunately, as the code was developed on the company&amp;#39;s dime, it had to remain behind when I was downsized. 
 So far, my current searches</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>RE: [VBA] Right Click Popup Menu from Userform</title><link>https://communities.bentley.com/thread/331121?ContentTypeID=1</link><pubDate>Thu, 16 Jul 2015 17:09:51 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:04936bbd-453e-43b0-b765-b94df4e18614</guid><dc:creator>Jon Summers</dc:creator><description>&lt;p&gt;That screenshot looks like Excel.&amp;nbsp; As I wrote already, an &lt;em&gt;Office&lt;/em&gt; VBA macro that uses the &lt;span style="font-family:courier new,courier;"&gt;CommandBars&lt;/span&gt; object won&amp;#39;t work with MicroStation VBA.&amp;nbsp; MicroStation VBA does not provide a &lt;span style="font-family:courier new,courier;"&gt;CommandBars&lt;/span&gt; object.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [VBA] Right Click Popup Menu from Userform</title><link>https://communities.bentley.com/thread/331097?ContentTypeID=1</link><pubDate>Thu, 16 Jul 2015 15:18:36 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:9f8ad47f-1550-47b5-9fdf-4efb646bd380</guid><dc:creator>Kadr Leyn</dc:creator><description>&lt;p&gt;I made an example about &amp;quot;pop-up menu on userform &amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file/__key/communityserver-discussions-components-files/343173/userform_5F00_menu2.jpg"&gt;&lt;img src="/resized-image/__size/940x0/__key/communityserver-discussions-components-files/343173/userform_5F00_menu2.jpg" alt=" " /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;For View :&amp;nbsp;&lt;a href="https://netmerkez.wordpress.com/2015/07/15/creating-pop-up-menu-on-userform/"&gt;netmerkez.wordpress.com/.../creating-pop-up-menu-on-userform&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://adf.ly/1Kq7PT"&gt;You can Download Template Here&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [VBA] Right Click Popup Menu from Userform</title><link>https://communities.bentley.com/thread/286204?ContentTypeID=1</link><pubDate>Mon, 02 Jun 2014 17:24:39 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:f9b94e1a-b0ce-4d13-9d81-8df8fa554bd7</guid><dc:creator>caddcop</dc:creator><description>&lt;p&gt;I cannot be sure this is how I did it, as much of what I just tried is not familiar at all. But it appears to be a possibility.&lt;/p&gt;
&lt;p&gt;Created a List Box on my user form using these properties - Key items: BackColor (menu color), Special Effect - Raised, Visible = False, Column width (smaller than text placed in it - prevents scroll bars).&lt;/p&gt;
&lt;p&gt;&lt;a href="/cfs-file.ashx/__key/communityserver-discussions-components-files/343173/4442.Screenshot-_2D00_-6_5F00_2_5F00_2014-_2C00_-1_5F00_04_5F00_51-PM.png"&gt;&lt;img src="/resized-image.ashx/__size/690x0/__key/communityserver-discussions-components-files/343173/4442.Screenshot-_2D00_-6_5F00_2_5F00_2014-_2C00_-1_5F00_04_5F00_51-PM.png" alt=" " border="0" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;With userForm code along these lines:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Private Sub UserForm_Initialize()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.ListBox1.AddItem (&amp;quot;Copy&amp;quot;)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.ListBox1.AddItem (&amp;quot;Paste&amp;quot;)&lt;br /&gt;End Sub&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Private Sub UserForm_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Button = 2 Then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.ListBox1.ListIndex = -1&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.ListBox1.Top = Y - (Me.ListBox1.Height / 2)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.ListBox1.Left = X - (Me.ListBox1.Width / 2)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.ListBox1.Visible = True&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.ListBox1.Font.Size = 10&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ElseIf Button = 1 Then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.ListBox1.Visible = False&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End If&lt;br /&gt;End Sub&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Private Sub ListBox1_Click()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Me.ListBox1.ListIndex = 0 Then Debug.Print &amp;quot;Copy to Clipboard&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If Me.ListBox1.ListIndex = 1 Then Debug.Print &amp;quot;Paste from Clipboard&amp;quot;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Me.ListBox1.Visible = False&lt;br /&gt;End Sub&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;As you can see, this version only writes to the immediate window - but if that works, my copy to clibboard code will work.&lt;/p&gt;
&lt;p&gt;Initially, I placed the .Top and .Left of the list box at Y and X. But I decided to center the list box on the mouse to keep mouse clicks too near an edge from looking too strange - as the listbox does not really float over the form like a commandbar.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [VBA] Right Click Popup Menu from Userform</title><link>https://communities.bentley.com/thread/286196?ContentTypeID=1</link><pubDate>Mon, 02 Jun 2014 16:19:55 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:8c456115-9bb8-47d6-90bc-184091ff1171</guid><dc:creator>caddcop</dc:creator><description>&lt;p&gt;From what I can recall of my earlier effort, The popup menu was pretty crude and did not function 100% like a true right click menu, but resembled one enough that users could follow its intent.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m thinking, it might have even been a hidden, raised listbox that I made visible at the cursor position, if that&amp;#39;s possible. This was over 5 years ago so it&amp;#39;s s pretty distant memory.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [VBA] Right Click Popup Menu from Userform</title><link>https://communities.bentley.com/thread/286178?ContentTypeID=1</link><pubDate>Mon, 02 Jun 2014 14:17:37 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:d5ddbf5b-2f4d-4475-86c5-0c242f53ec93</guid><dc:creator>Jon Summers</dc:creator><description>&lt;p&gt;[quote user=&amp;quot;Robert Hook&amp;quot;] I would suggest reviewing the Microsoft VBIDE and a respective Microsoft Office object model[/quote]&lt;/p&gt;
&lt;p&gt;The problem for us is that the Microsoft Office implementation of VBA includes a &lt;span style="font-family:courier new,courier;"&gt;CommandBars&lt;/span&gt; object.&amp;nbsp; It&amp;#39;s the absence of that object in MicroStation VBA that makes it hard to add a menu.&amp;nbsp; I&amp;#39;d be happy to be shown to be wrong&amp;nbsp; 8-)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [VBA] Right Click Popup Menu from Userform</title><link>https://communities.bentley.com/thread/286175?ContentTypeID=1</link><pubDate>Mon, 02 Jun 2014 14:05:18 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:68d6bf1c-e146-49a7-8024-3c94d33ff9d0</guid><dc:creator>Robert Hook</dc:creator><description>&lt;p&gt;FWIW.&amp;nbsp; This topic would probably receive more authoritative input from Microsoft programming forums.&amp;nbsp; From my quick look I would suggest reviewing the Microsoft VBIDE and a respective Microsoft Office object model; and implement similar code as found in this Microsoft post: &lt;a href="http://msdn.microsoft.com/en-us/library/office/aa433244(v=office.12).aspx"&gt;Adding and Displaying Shortcut Menus&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;HTH,&lt;br /&gt;Bob&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: [VBA] Right Click Popup Menu from Userform</title><link>https://communities.bentley.com/thread/286166?ContentTypeID=1</link><pubDate>Mon, 02 Jun 2014 13:34:03 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:60397bb0-64d7-470f-a7ad-7d996e5552a9</guid><dc:creator>Rod Wing</dc:creator><description>&lt;p&gt;Try using the MouseDown event. A Button value of 2 equates to the right click.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;code&gt;Private Sub TxtBxNorthing_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)&lt;br /&gt;&amp;nbsp; &amp;nbsp; If Button = 2 Then&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Set odata = New DataObject&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; odata.Clear&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; odata.SetText Me.TxtBxNorthing.Text&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; odata.PutInClipboard&lt;br /&gt;&amp;nbsp; &amp;nbsp; End If&lt;br /&gt;End Sub&lt;/code&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>