Bhagwant

I have created one macro to  collect the tag information from .dgn files.

I would like to run this through VBA .

is it possible to run this macro thru VBA.

Sub main()


Dim element As New MBEElement
Dim filepos As Long
Dim origin As MBEpoint


Dim point1 As MBEpoint
Dim point2 As MBEpoint

Dim filenum As Integer
Dim filename As String
Dim DgnDir As String
Dim inputstring As String
Dim inputstringLN As String
Dim inputstring1 As String
Dim inputstring2 As String
Dim inputstringt As String
Dim inputstring3 As String
Dim inputstring4 As String
Dim inputstring5 As String
Dim inputstring6 As String
Dim inputstring7 As String
Dim inputstring8 As String
Dim inputstring9 As String
Dim inputstring10 As String

Dim elemSet As New MbeElementSet

Dim setMember As MbeSetMember
Dim gotElement As Integer
Dim gotES As String

Dim sout As String
Dim state As Long
Dim stat As Long


filenum = FreeFile
filename = "c:\elemouts.txt"
Open filename For Output As #1

'DgnDir$ = Dir("D:\bentley\*.dgn")

Dim dgnFile$(1 To 1000) ' Array for 100 DGN names
Dim numFiles As Integer
numFiles =1
dgnFile(numFiles) = Dir$("*.i01") ' Get first design file name

'mbemessagebox "Check It"

Do While dgnFile(numFiles) <>""


'dgnFile(numFiles) = Dir$() '
'print numFiles
'print dgnFile(numFiles)


MbeSendCommand "rd=" & dgnFile(numFiles)
'mbemessagebox "Got It"

'DgnDir$ = Dir("D:\bentley\*.dgn")
' Do While DgnDir <> ""
' MbeSendCommand "rd=" & DgnDir

'First fence start

MbeSendCommand "PLACE FENCE ICON"


point1.x = 587.4120
point1.y = 179.5221

MbeSendDataPoint point1,1%

point2.x = 596.4463
point2.y = 185.5094


MbeSendDataPoint point2,2%


MbeSendDragPoints point1, point2, 2
'mbemessagebox "fen Placed"

If elemSet.fromFence() = MBE_Success Then
'mbemessagebox "fen"


gotElement = elemSet.getFirst(setMember)


if gotElement = MBE_Success then

filepos = element.fromFile(setMember.filepos, setMember.filenum)


' mbemessagebox "gotElement"


If element.Type = 17 Then
'mbemessagebox "text"
stat = element.getstring(sout)

'mbemessagebox "t" +sout
' print element.type


inputstring1$ = sout + ";"
Else
'mbemessagebox "No"
' print element.type
End If

'write filenum, inputstringp

Related
Recommended