dj44
05-27-2017, 06:13 PM
Folks good Saturday,
Well my list box was working as far as I can tell
And I added the column to run the macro
Option Explicit
Private Sub UserForm_Initialize()
'Stolen from Greg :)
Dim arrData() As String
Dim sourcedoc As Document
Dim i As Long
Dim j As Long
Dim myitem As Range
Dim m As Long
Dim n As Long
Application.ScreenUpdating = False
i = ActiveDocument.Tables(1).Rows.Count - 1
j = ActiveDocument.Tables(1).Columns.Count
ListBox1.ColumnCount = j
ReDim arrData(i - 1, j - 1)
For n = 0 To j - 1
For m = 0 To i - 1
Set myitem = ActiveDocument.Tables(1).Cell(m + 2, n + 1).Range
myitem.End = myitem.End - 1
arrData(m, n) = myitem.Text
Next m
Next n
ListBox1.List = arrData
lbl_Exit:
Exit Sub
End Sub
Private Sub ListBox1_Change()
Application.Run "Macros. & ListBox1.Column(3) '<< Did work but then :("
'Application.Run ListBox1.Column(3)
End Sub
19305
But now the macro doesn't fire
I don't know what's wrong with it
If someone can take a look at this I would be very grateful
Well my list box was working as far as I can tell
And I added the column to run the macro
Option Explicit
Private Sub UserForm_Initialize()
'Stolen from Greg :)
Dim arrData() As String
Dim sourcedoc As Document
Dim i As Long
Dim j As Long
Dim myitem As Range
Dim m As Long
Dim n As Long
Application.ScreenUpdating = False
i = ActiveDocument.Tables(1).Rows.Count - 1
j = ActiveDocument.Tables(1).Columns.Count
ListBox1.ColumnCount = j
ReDim arrData(i - 1, j - 1)
For n = 0 To j - 1
For m = 0 To i - 1
Set myitem = ActiveDocument.Tables(1).Cell(m + 2, n + 1).Range
myitem.End = myitem.End - 1
arrData(m, n) = myitem.Text
Next m
Next n
ListBox1.List = arrData
lbl_Exit:
Exit Sub
End Sub
Private Sub ListBox1_Change()
Application.Run "Macros. & ListBox1.Column(3) '<< Did work but then :("
'Application.Run ListBox1.Column(3)
End Sub
19305
But now the macro doesn't fire
I don't know what's wrong with it
If someone can take a look at this I would be very grateful