View Single Post
 
Old 05-01-2023, 09:38 PM
mdlewis mdlewis is offline Windows 7 64bit Office 2010
Novice
 
Join Date: Jan 2019
Posts: 11
mdlewis is on a distinguished road
Default VBA read Word Docx where "rec" delimiter is #

I have a source Word document consisting of "logical" records. Each record block starts with a # (hash) character and finishes just before the next. There may be several paragraphs within. I want to slurp up, all of the text from a # mark to just before the next and move it into an access long text variable for further processing. This is a snippet of code. But I need a wraparound to select each paragraph. Can I be helped?

like:

For Each singleParagraph In ActiveDocument.XXX ********************

and continue

For Each singleLine In ActiveDocument.Paragraphs - replace to current paragraph

LineText = Trim(singleLine.Range.Text)

If Len(LineText) >= 32767 Then
Debug.Print Len(LineText)
' Stop
End If

If Left(LineText, 1) = "#" Then

'// parse the text here...
Reply With Quote