Good Morning
First time poster, been lurking around for a while to assist with some of my coding needs here and there. If I miss anything in my question please let me know.
What I'm trying to achieve at the moment is a set of Dim parameters that can be used in multiple Private Subs in my form.
For example:
Private Sub ListBox4_Click()
Dim ALB, ALB1F, ALB1L, ALB1E, ALB2F, ALB2L, ALB2E As String
ALB = "CompanyName"
ALB1F = "FirstName"
ALB1L = "LastName"
ALB1E = "Email"
ALB2F = "FirstName"
ALB2L = "LastName"
ALB2E = "Email"
If ListBox4 = ALB Then
Me.ListBox3.Clear
With ListBox3
.AddItem ALB1F & " " & ALB1L
.AddItem ALB2F & " " & ALB2L
End With
I would like this Dim information to be accessible within another sub class such as the following:
Private Sub CommandButton2_Click()
If ListBox4.Text = ALB Then
ActiveDocument.Tables(1).Cell(14, 2).Select
Selection.TypeText Text:=ALB1F & " " & ALB1L & " ("
ActiveDocument.Hyperlinks.Add Anchor:=Selection.Range, Address:=ALB1E, SubAddress:="", ScreenTip:="", _
TextToDisplay:=ALB1E
Selection.TypeText Text:=")"
Set myRange = ActiveDocument.Tables(1).Cell(14, 2).Range
With myRange.Font
.Name = "Verdana"
.Size = 8
End With
I've done some online digging and cannot seem to find the exact solution for the above, or I'm missing some code or incorrectly inputting my code which is all very possible (I'm self teaching myself to do VBA).
Any help would be much appreciated.