Insert Bullet and Text

B

Benz

Hi,

Below is userform code im working on and I believe im close .. but just
can't seem to get it to work. I know my code isint proffesional at all, but
I hope you get the idea of what I was doing.

Code Objective: Open a document which contains a table , search col1 for the
word that matches a textbox in the userform (which becomes the target row)
then depending on what the user selects in the dropdown deteminds the target
Col to add a bullet to the list.

*Note opening the doc and every thing works just not the inserting a bullet

Thank you to anyone that helps.

Happy Holidays!

Ben Z.

CODE:

Private Sub CommandButton1_Click()

'Works with custom toolbar
Dim sendbar As CommandBar
Dim sendbox As CommandBarControl
Set sendbar = Application.CommandBars("Todays-Task")
Set sendbox = sendbar.Controls(2)
Set sendtopic = sendbar.Controls(1)

Dim Word As New Word.Application
Dim WordDoc As New Word.Document
Word.Visible = True 'Only true during testing'
Dim strPath As String

'Open word doc'
C = ActiveDocument.CustomDocumentProperties("Task").Value
strPath = "C:\MyDocuments\" & T & "\Planning\2007\Todos.doc"
Set WordDoc = Word.Documents.Open(strPath)
With WordDoc

System.Cursor = wdCursorWait
Dim oTbl As Table
Dim oCll As Cell

'<><><><><>Search Col(1) For Keyword<><><><><><><>'

Set oTbl = WordDoc.Tables(1)
With oTbl
For Each oCll In .Columns(1).Cells
If oCll.Range.Text = sendtopic.Text Then
p = oCll.RowIndex
End If
Exit For
Next
End With

'<><><><> Based on userform info<><><>'
If ComboBox2.Text = "Pay" Then

Set oTbl = WordDoc.Tables(1)
Set Selec = oTbl.Cell(p, 4)
With Selec
.EndOf Unit:=wdCell
.TypeText Text:=sendbox.Text
End With

WordDoc.SAVE

WordDoc.Application.Quit

System.Cursor = wdCursorNormal

MsgBox "Task Updated"

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top