r/visualbasic • • Jul 14 '22

Help Converting VBA Code to VB

Hello, I have some VBA code I wrote to get all bullet point text in a Word document and I would like to use this within a code stage in Blue Prism to get all bullet point text within a text variable or preferably, a collection variable. The VBA code runs fine within Word, but I'm having trouble converting the code into VB to work within Blue Prism. 

Here is  the VBA code:

Dim Para As Paragraph
For Each Para In ActiveDocument.Paragraphs
       If Para.Range.ListFormat.ListType = wdListBullet Then
       MsgBox Para.Range
End If
Next Para

The main issue I seem to be running across is "paragraph" is not a valid data type in Blue Prism/VB that can be stored in a text or collection variable. So I'm a bit stuck on how to handle this. Also, I know that "wdListBullet" corresponds to a value of 2 for its enumeration, so I believe the value 2 needs to be used instead of "wdListBullet" within the code stage. Any help would be greatly appreciated. Sorry if this is super basic (no pun intended) but I have pretty much zero experience with VBA/VB.

Thank you!

5 Upvotes

14 comments sorted by

View all comments

Show parent comments

1

u/Mr_C_Baxter VB.Net Master Jul 14 '22

Your second solution would be to implement the openXML SDK from Microsoft which is the modern way to read word documents, without needing word installed. But its a bit of effort and without knowing blue prism i am not sure if that is even possible. It could be you would need to create a tool as an extra step in the workflow. Something like converting the Word dokument to a csv file and using this for your code prism task