WORD MACROS AND THEIR USE        home.gif (668 bytes)mail.gif (584 bytes)
 

TEXT FILE GENERATION USING VB SCRIPT MACROS

The generation of the VB script macro serves the basic purpose as to parse the word file in which the design engineer has given raw data. The raw data is given in the form of tables in the word document. Hence each and every cell of the different rows in the table has to be parsed and the relevant information has to stored in the form of a text file. This exercise is carried out because it is easy to access any text file in languages like Java, C++ etc. The VB Script Macro is run on this file and the macro stores the information in the text file .The text file generated later is illustrated for this table itself for simplicity in understanding

 

Register Entity Name txpohreg Register Bank Type TCMD
Address 041H
Bit Access Function Default Value Signal Name Description
15-8 Unused 0 Unused
7 RW RDI-P Code 000 Rdi_code Code transmitted for RDI-P
6-0 RW Transmit Z5 0 Inset_z5_byte Z5 is transmitted when ONE

This file is stored with the same name as that of the word document file on which the macro is run. The extension is given as "filename.doc.txt". A well-formatted display file is also generated with the extension "filenameDisplay.txt". Both the display and the txt file are stored in the same folder as that of the word document.

 

ALGORITHM TO GENERATE TEXT FILE USING MACROS

  1. Open the Document.
  2. Create File object & A new text file With the same name as ActiveDocument is opened in the same directory where the ActiveDocument is.
  3. Go to the First table,
  4. Count number of Rows in that Table,
  5. If No. of Rows are One, go to next table,
  6. Count number of Columns,
  7. Go to each cell and send the text to file,

Repeat step 3-7, until all tables are over.

STEPS TO RUN THE MACRO:

  1. Open the Word Document in which the raw data is present in tabular format
  2. Click on the "TOOLS" menu and then on Macro option-Macros or simply press Alt+F8.
  3. Select the macro name from the list which appears here
  4. Click on "Run" button and the macro will automatically parse the document and will store the information in the text file with the same name as that of the active document with the extension ".doc.txt"
  5. If the macro maker has assigned a short key to the macro then just by pressing the short-cut key the macro runs and the desired action is performed. But this assignment depends upon the macro programmer and can be different for different machines.

FORMAT OF TEXT FILE

Register Entity Name txpohreg \n Register Bank Type TCMD \n EoR \n Address 041H \n EoR \n Bit \n Access \n Function \n Default Value \n Signal Name \n Description \n EoR \n 15-8 \n \n Unused \n 0 \n Unused \n EoR \n 7 \n RW \n RDI-P Code \n 000 \n Rdi_code \n Code transmitted for RDI-P \n EoR \n 6-0 \n RW \n Transmit Z5 \n 0 \n Inset_z5_byte \n Z5 is transmitted when ONE \n EoR \n EoT \n

FORMAT OF THE DISPLAY FILE

Start*******

>> Showing the Structure :

**> BANK : TCMD

====> REGISTER (Addr) : txpohreg (41H)

Used Bits : 8 Of 16

______________________________

_____StartBit :15

_____EndBit :8

_____BusWidth :8

_____AccessType :

_____FunctionName :Unused

_____DefaultValue :0

_____SignalName :

_____Description :Unused

_______________________________

Similar display for the rest of the bits in the PIN Description given above.

_______________________________________________________________