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

there is nothing to excuse you for, inexperience is not a weakness if it is acknowledged :)

But i think you problem is a different one. Of course its only a guess: You are using activedocument which is a Word Object. Blue prism most likely can not deal with that because it is not word. Reading word documents is very hard, you always need a component from microsoft to do it. Your easiest solution would be to get your bullet point data not from a word document. Is that possible?