Vis_Bas_App
06-22-2005, 08:55 AM
Hello Everybody,
I am new to this board and have my first question for which your help would be greatly appreciated.
I am developing a tool using VBA which transfers the contents of cells in a Word table to cells in an Excel Spreadsheet.
The tool is almost complete but there is a problem in that the document contains bullet points. I need to remove these bullet points from the word document and replace them with semi-colons before transferring the string data to the Excel cells.
I know that there is a way of getting rid of all bullet points in a Word document but this is not sufficient as the lists still need to be seperated in some way (i.e semi-colons).
I have looked on numerous web sites and tried many different ways of tackling this Unicode related issue (using the ChrW function mainly).
I wrote the following function in an attempt to replace bullet points with semi-colons but it is not working:
Private Sub Find_Unicode()
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim MyString As String
Set wrdApp = CreateObject("Word.Application")
Set wrdDoc = wrdApp.Documents.Open("C:\Bullets.doc")
wrdApp.ActiveDocument.ConvertNumbersToText
wrdDoc.Range.WholeStory
wrdApp.ActiveDocument.Content.Font.Name = "Symbol"
MyString = ChrW(61623)
MsgBox MyString
wrdDoc.Range.Find.ClearFormatting
wrdDoc.Range.Find.Replacement.ClearFormatting
With wrdDoc.Range.Find
.Text = MyString
.Replacement.Text = ";"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
wrdDoc.Range.Find.Execute Replace:=wdReplaceAll
If wrdDoc.Range.Find.Found = True Then
MsgBox "Found Unicode Bullet Point - Replacing!", vbInformation, "Value"
End If
wrdDoc.Save
wrdDoc.Close
wrdApp.Quit
Set wrdDoc = Nothing
Set wrdApp = Nothing
MsgBox "Finished Replacing Bulleted Lists", vbInformation, "Information"
End Sub
I am unsure as to whether I should be getting rid of the bulleted formatting before searching to replace the non-formated circular bullet character and even more unsure as to the actual Integer value for a circular bullet as different web sites quote different numbers.
Any advice would be much appreciated! http://www.andreavb.com/forum/emoticons/smiley.gif500) {this.width=500;this.alt='Full View';}" border=0> (http://www.andreavb.com/forum/emoticons/smiley.gif)
I am new to this board and have my first question for which your help would be greatly appreciated.
I am developing a tool using VBA which transfers the contents of cells in a Word table to cells in an Excel Spreadsheet.
The tool is almost complete but there is a problem in that the document contains bullet points. I need to remove these bullet points from the word document and replace them with semi-colons before transferring the string data to the Excel cells.
I know that there is a way of getting rid of all bullet points in a Word document but this is not sufficient as the lists still need to be seperated in some way (i.e semi-colons).
I have looked on numerous web sites and tried many different ways of tackling this Unicode related issue (using the ChrW function mainly).
I wrote the following function in an attempt to replace bullet points with semi-colons but it is not working:
Private Sub Find_Unicode()
Dim wrdApp As Word.Application
Dim wrdDoc As Word.Document
Dim MyString As String
Set wrdApp = CreateObject("Word.Application")
Set wrdDoc = wrdApp.Documents.Open("C:\Bullets.doc")
wrdApp.ActiveDocument.ConvertNumbersToText
wrdDoc.Range.WholeStory
wrdApp.ActiveDocument.Content.Font.Name = "Symbol"
MyString = ChrW(61623)
MsgBox MyString
wrdDoc.Range.Find.ClearFormatting
wrdDoc.Range.Find.Replacement.ClearFormatting
With wrdDoc.Range.Find
.Text = MyString
.Replacement.Text = ";"
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
wrdDoc.Range.Find.Execute Replace:=wdReplaceAll
If wrdDoc.Range.Find.Found = True Then
MsgBox "Found Unicode Bullet Point - Replacing!", vbInformation, "Value"
End If
wrdDoc.Save
wrdDoc.Close
wrdApp.Quit
Set wrdDoc = Nothing
Set wrdApp = Nothing
MsgBox "Finished Replacing Bulleted Lists", vbInformation, "Information"
End Sub
I am unsure as to whether I should be getting rid of the bulleted formatting before searching to replace the non-formated circular bullet character and even more unsure as to the actual Integer value for a circular bullet as different web sites quote different numbers.
Any advice would be much appreciated! http://www.andreavb.com/forum/emoticons/smiley.gif500) {this.width=500;this.alt='Full View';}" border=0> (http://www.andreavb.com/forum/emoticons/smiley.gif)