First, thank you in advance...everyone here has been incredible
So what I am trying to do is use two comboboxes (cb_RNNumberPayments and cb_CountCohorts) to insert a table into my document at a bookmark "FeeTable". Also I am trying to make sure to format the table correctly (but that is probably a future struggle). Now because the table has a header (so need to have it oRow+1) and has two additional columns (oCol +2) and based on what I have read, comboxes do not read as integers, I am running into a load of issues. I can get it to work if I just set oRow =4 and oCol =4 but since each the column and row numbers are different everytime, I want to write it to be based off the comboboxes...make senser? I am also looking to insert specific text into the column headers (Col1 Nursing Program Class, Col2 First Term, Col3 Second Term, Col4-6 are dependent on if the column exist based on the combobox cb_RNNumberPayments and the last col should be Total Fee
Sub FeeTable()
Dim oRng As Word.Range, oTbl As Word.Table
Dim RNPayment As Integer
Dim nCohort As Integer
Dim oRow As Integer
Dim oCol As Integer
Set oRng = ActiveDocument.Range.Bookmarks("FeeTable").Range
Set oCol = cb_RNNumberPayments.Value + 2
Set oRow = cb_CountCohorts.Value + 1
Set oTbl = ActiveDocument.Tables.Add(Range:=oRng, NumRows:=oRow, _
NumColumns:=oCol)
ActiveDocument.Bookmarks.Add "FeeTable", oTbl.Range
oTbl.Rows.SetLeftIndent LeftIndent:=InchesToPoints(0.3), _
RulerStyle:=wdAdjustSameWidth
With oTbl
.Borders.InsideLineStyle = wdLineStyleSingle
.Borders.InsideLineWidth = wdLineWidth025pt
.Borders.InsideColor = wdColorBlack
.Borders.OutsideLineStyle = wdLineStyleSingle
.Borders.OutsideLineWidth = wdLineWidth025pt
.Borders.OutsideColor = wdColorBlack
End With
On Error Resume Next
lbl_Exit:
Exit Sub
End Sub