#1
|
|||
|
|||
Trying to get number of para in Combobox
Hello
Basically i was tryling to upload the all the written paragraph numbers into Combobox and not the Empty ones I tried the following code but not able to upload the values in combobox one below the other Code:
Dim aPar As Paragraph, sList As String, i As Long, sText As String, prghCnt As Integer, myArrayParaList As Variant For i = 1 To ActiveDocument.Paragraphs.Count sText = Trim(Trim(ActiveDocument.Paragraphs(i).Range.Text)) If Split(sText, vbCr)(0) <> "" Then sList = sList & "," & i myArrayParaList = Array(sList) End If Next i cmbParaNos.List = myArrayParaList Will appreciate if you could help me in correcting the same Thank you SMehta |
#2
|
|||
|
|||
SMehta
Try the following Code:
Dim aPar As Paragraph, sList As String, i As Long, sText As String, prghCnt As Integer, myArrayParaList As Variant For i = 1 To ActiveDocument.Paragraphs.Count sText = Trim(Trim(ActiveDocument.Paragraphs(i).Range.Text)) If Split(sText, vbCr)(0) <> "" Then sList = sList & i & "," myArrayParaList = Split(sList, ",") End If Next i cmbParaNos.List = myArrayParaList This does the trick and you wiil have Para nos in your combobox one below the other. SamD |
#3
|
|||
|
|||
Thanks a tonne SamD
Indeed this was perfect one. Now Slowly Getting bit familar with VBA-Word SMehta Thread 1: No: 46512 : Post No2 : TM 18 |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Formatting is not confined to just the one para | cryptogram | Word | 3 | 07-28-2015 12:45 PM |
Getting rid of para keystrokes at the end of every line | baudinot | Word | 1 | 01-05-2012 03:37 PM |
Don't add space between para of the same style | ghumdinger | Word | 3 | 09-19-2011 02:04 AM |
distorted last para lines when justifying | RSF | Word | 0 | 08-18-2011 10:11 PM |
Tables that carry hidden para styles | Ulodesk | Drawing and Graphics | 4 | 03-10-2011 08:16 AM |