- Trained on our vast library of engineering resources.
Learning MicroStation VBA

Chapter 30: Batch Processing

The ability to rapidly process 10, 100, or even 1000 files is as simple as it is powerful.

Processing Files Listed in an ASCII File

It is common to have a list of files that need processing in an ASCII text file. Here is an example:

This first example opens the file ProcessThese.txt, reads each line in it, then displays each line in a MessageBox.

Sub <b class="bold">ProcessASCII</b>()    Dim FileToOpen As String    Dim BatchFile As String    Dim FFile As Long    FFile = FreeFile    BatchFile = "C:\MicroStation VBA\BatchProcessing\ProcessThese.txt"    Open BatchFile For Input As #FFile    While EOF(FFile) = False        Line Input #FFile, FileToOpen        MsgBox FileToOpen    WendEnd Sub

Now that the basics are in place, let's build on them.

Sub <b class="bold">ProcessASCIIB</b>()    Dim FileToOpen As String    Dim BatchFile As String    Dim FFile As Long    FFile = FreeFile    BatchFile = "C:\MicroStation VBA\BatchProcessing\ProcessThese.txt"    Open BatchFile For Input As #FFile    While EOF(FFile) = False        Line Input #FFile, FileToOpen        Application.OpenDesignFile FileToOpen, True        MsgBox "Do Something"    WendEnd Sub

Instead of just showing the file...

UNLIMITED FREE ACCESS TO THE WORLD'S BEST IDEAS

SUBMIT
Already a GlobalSpec user? Log in.

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.

Customize Your GlobalSpec Experience

Category: Photovoltaic (PV) / Solar String Monitors
Finish!
Privacy Policy

This is embarrasing...

An error occurred while processing the form. Please try again in a few minutes.