Populating DataEntryRegions in a cell from VBA textbox

Hello everyone,

This is my first post on Be Communities, so if anything is wrong do not judge me very strictly.. I was browsing this great website for over a week now trying to find a solution to my problem, but still seem to be stuck on it...

I work for a company who uses Microstation V8 XM Edition to design railway signalling systems and they asked me (IT guy) to produce a macro which would enable them to save time and reduce number of mistakes.

Ok, here is my problem. I got a user interface created in VBA and i got three textboxes. User will need to input data into these boxes and then by pressing "Process" button macro shall populate particular cells in .dgn file with info from textboxes. Each cell has 5 DataEntry Regions so I need to use them.

Name of a whole cell is: UP_EDF.

The problem is that I'm a complete newbie with Microstation and cannot really workout how to do it. I do have experience working with VB.

I was able to find like a guide which one of Be Community's members posted:

1. Get Cell Element.
2. Enumerate over the contents of the cell using CellElement.MoveToNextElement
3. For each TextElement encountered, determine if it has DataEntryRegions and how many (TextElement.DataEntryRegionsCount).
   Each TextElement can have 0 or more EDFields. You will want to keep track of which EDField you want to populate. For example, if you have 2 TextElements with 2 EDFields each, then to populate EDField number 3 in the entire cell, you would want the first EDField in the second Text Element.
4. Once you have the desired TextElement then you would grab a copy of it from the Cell Enumerator using CellElement.CopyCurrentElement.
5. Populate the desired EDField(s) using TextElement.DataEntryRegionText(idx)=newText.
6. Then you would update the TextElement in the cell by writing back with CellElement.ReplaceCurrentElement <updated TextElement>

But it is not really taking me very far...

I have also attached a picture of a cell I'm trying to update. I would really appreciate your help.

Thank you guys in advance.