Where to place and organize VBA code for users from other computers to use?

expeo

New Member
Joined
Dec 1, 2017
Messages
17
I am attempting to build an interactive document where users can pick from a drop down and a display would show up based on the item picked from the drop down.

Sub ComboBox1_Change() ‘this would be the drop down menu for the user to choose from.
With ComboBox1
.AddItem "AA"
.AddItem "BB"
.AddItem "CC"
End With
End Sub

Sub TextBox1_Change()
If ComboBox1.Value = "AA" Then
TextBox1.Text = "11"
ElseIf ComboBox1.Value = "BB" Then
TextBox1.Text = "22"
ElseIf ComboBox1.Value = "CC" Then
TextBox1.Text = "33"
End If
End Sub

I am having a hard time understanding where to write the code if this document will be passed around (via email) so that all users from different computers can use it.

Would I need to create a UserForm under Forms? Have it under Microsoft Objects? Have it defined as Macros in Modules?

Extra Questions
If this is going to be placed inside Word, can I possibly link it from Excel (to extract data or validate data)?
What would be the difference between Private Sub, Public Sub, and Sub?
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Cross posted https://www.excelforum.com/excel-pr...-from-other-computers-to-use.html#post4833254

Cross-Posting
While we do not prohibit Cross-Posting on this site, we do ask that you please mention you are doing so and provide links in each of the threads pointing to the other thread (see rule 13 here along with the explanation: Forum Rules). This way, other members can see what has already been done in regards to a question, and do not waste time working on a question that may already be answered.
 
Upvote 0
You've shown us code from UserForm controls. So I guess it belongs in a UserForm. What happens once you've populated the textbox? Does something then get put into the document (and what kind of document)? Or is it only displayed in the form and it goes away when the user closes the form?

This sounds like the kind of thing that add-ins are good at.
 
Upvote 0

Forum statistics

Threads
1,223,896
Messages
6,175,265
Members
452,627
Latest member
KitkatToby

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top