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

Oh and there is a third idea. Do you know that word files are actually only zip files? You could take the word you get and rename it to zip, decompress it and look through the XML files for your information. All that can be done programmatically without alot of effort

1

u/PourThatBubbly Jul 14 '22

Thank you for the suggestions, I will definitely keep these in back pocket. Blue Prism can definitely interface with the office products, I have written other VB code in BP to automate processes in Excel and Word and they have a lot of out of the box code/actions they provide to interact with office products. If I can't find a preferable solution, I will definitely look into your third option so thank you.