Category Archives: Computer Science

About computers, algorithms and unusual troubleshoots.

Changing company name in

To change the name of company for which is licensed, use following steps:

  • Open registry by running Regedit
  • Scroll down through the displayed lists and expand STAADPro
  • Select 2007 (20.07.10 for STAAD.Pro SS5 or 20.07.11 for STAAD.Pro SS6)
  • Double Click on Username
  • Enter your desired Company name as shown in attached screen capture.

Word cound in MS-Word using Fields

Sometimes you want to count the number of words in MS word file excluding titles, references etc. To do this follow these steps:
First count the number of words that has to be ignored (by selecting them, the status bar at bottom shows the number of selected words e.g. 15/1542)
Insert field using Ctrl+F9. a double bracket {} should appear.
type =
then insert field codes from insert menu (like number of pages, words etc:: insert>quickpart>fields>NumWords)
it should look like {=130-12}
right click and toggle the field code.

Now if you change the document, update the field code by selecting it and pressing F9 button.

Autocad calculation using fields and blocks

While drafting in AutoCAD, sometimes we come to situation where we need to upadate some text based on values of other text (similar to using formulas as in excel). In such case we can use FIELDS of Autocad to do our calculations and update the drawings automatically.


The basic method to use field is very easy. Try following steps to get the idea.

>>MTEXT (type some number say 151) and click ok

>>MTEXT>Instert Field (or directly use FIELD command) : a dialog box will appear as shown below


-Select Field category: Objects

-Field names: Formula

-In Formula filed: right click >insert field : this will open new field window (the idea is use field value within another field)

-In this new Filed dialog box choose

-Filed names: Objects

-Objet type:Select the Mtext with the input number


-Click Ok


Now in the original window there will be some value like 151 at the end type *2 so the content will look like 151*2

-Click ok

The new Mtext will change to value showing 302.

-To edit the formula, double click the field.

Now if the first Mtext value is changed to 100 from 151 then after REGENERATEing the drawing. The field will show 200.

For blocks

The fields will work not only in Mtext but also in Block attributes, hence making life easy to create blocks which has multiple values based on some formula of few input parameters. For eg a scale block (as shown below). However, there are few differences. A sample method is given below using example of scale block:


– Draw the shapes (lines, hatch etc)

-Define block attributes (name them L1, R1,R2,R3,R4,R5,SCALE) (i made SCALE as hidden so that it will not be visible and will be used for calculation only) also i made all tags prompting to “DO NOT EDIT” as you will see later as these values should be updated automatically).

-Create block using BLOCK command

Now double click the box to change attibute value (say for value of L1).

-in Value field >right click>edit field

Now the field dialog box appears as discussed above.

-Select formula in field name

-in formula right click >Add fileds

New field dialog box appears

-select Object in field names

-select the Block that you had just created in Object type

-all tags will appear in the property (L1, R1,R2,R3,R4,R5,SCALE)

-Chose the tag that you want to use (here SCALE). Click ok

Back in the formula write the required formula using this variable (eg 1000*50)

-Click ok

Close all the dialog box

Now if you change value of SCALE tag and regenerate, the value of L1 will change according to the formula specified.

Repeat the process for all the tags to get required value.


Excel VBA code to concatenate with custom characters

Sometimes it is necessary to join the contents of cell with custom characters like +,-,:,|, etc. This can be achieved by using excel inbuilt function CONCATENATE. The problem with this function is you will have to specify the character every time. The function listed below will help to simplify this problem.

The function can take multiple arguments just like =SUM() function.



the result: all the cell values of a1:c1 and b8 will be displayed separated by “+” sign.

The code:

' this function can take multiple parameters and return each cell value seperated by "+"
Dim i, j
Dim out
For i = LBound(args) To UBound(args)
    If IsNull(args(i)) = False Then 'check null value
            If IsArray(args(i)) = False Then 'check if arg is array
            'no array do usual
                If out = "" Then
                    out = args(i)
                ElseIf args(i) = "" Then
                    out = out
                    out = out & SEPERATOR & args(i)
                End If
            Else  ' arg is an array, do for array
                For j = 1 To args(i).Count
                    If out = "" Then
                        out = args(i)(j)
                    ElseIf args(i)(j) = "" Then
                        out = out
                        out = out & SEPERATOR & args(i)(j)
                    End If
                Next j
            End If ' array check end
    End If 'null check end

Next i

End Function

Cracking excel VBA password

To remove VBA password in Excel document use following steps. The steps are really simple and you can remove the password in no time.Backup the xls file first!

  1. Using a HEX editor, locate the DPB=… part
  2. Change the DPB=… string to DPx=…
  3. Open the xls file in Excel
  4. Excel discovers an invalid key (DPx) and asks whether you want to continue loading the project (basically ignoring the protection)
  5. Open the VBA editor (ALT+F11)
  6. Overwrite the password, so change it to something you can remember
  7. Save the xls file
  8. Close and reopen the document and work your VBA magic!

Solution was found at:

If you want to remove password from protected sheet then see