Hello everyone , is here any one to help me with visual basic macro?
here is the macro code :
VB Code:
  1. Attribute VB_Name = "gw_twocolumn"
  2. Sub gw_twocolumn_to_xml()
  3. str_startTime = Time
  4. CRLF = Chr(13) + Chr(10)
  5. str_range = ActiveWindow.RangeSelection.Address()
  6. str_1 = "<line><term>"
  7. str_2 = "</term><defn><trns>"
  8. str_3 = "</trns></defn></line>"
  9. Rem
  10. Rem
  11. Sheets.Add Count:=1, after:=Sheets(1)
  12. Worksheets(1).Activate
  13. Set r = Range(str_range)
  14. For n = 1 To r.Rows.Count
  15.     Worksheets(2).Cells(n, 1) = _
  16.     str_1 & r.Cells(n, 1) & _
  17.     str_2 & r.Cells(n, 2) & str_3
  18. Next n
  19. Worksheets(2).Columns(1).ColumnWidth = 150
  20. Rem
  21. Rem
  22. str_stopTime = Time
  23. double_elapsedTime = (str_stopTime - str_startTime) * 24 * 60 * 60
  24. MsgBox "Range: " & str_range & CRLF & _
  25.         "Elapsed time: " & double_elapsedTime & _
  26.         " sec."
  27. End Sub

When you open excel file , name one cloumn = term and the second one = defn ,when i run the macro the generated code in excel sheet look like this

---------------------------- XML Code Start----------------------------------
<line><term>rule</term><defn><trns>Control</trns></defn></line>
<line><term>manage</term><defn><trns>Supervise</trns></defn></line>
<line><term>management</term><defn><trns>Supervision</trns></defn></line>
-----------------------------Xml Code end------------------------------------

this macro is for making a dictionary so if you look at this code closely and look at the grammer point you may understand it well and i want the code to generate somthing like this

-------------------------------Xml Code start -------------------------------
<line><term t1="C" t2="CO" id="12">Control</term><defn><abbr lang="noun"></abbr>rule</defn></line>
<line><term t1="S" t2="SU" id="3">Supervise</term><defn><abbr lang="verb"></abbr>manage</defn></line>
<line><term t1="S" t2="SU" id="7">Supervision</term><defn>management</defn></line>
-------------------------------Xml Code end -------------------------------


Or like this

--------------------------------Xml Code Start ----------------------------
<line><term>Control</term><defn><abbr lang="noun"></abbr>rule</defn></line>
<line><term>Supervise</term><defn><abbr lang="verb"></abbr>manage</defn></line>
<line><term>Supervision</term><defn>management</defn></line>
----------------------------------Xml Code End -----------------------------

i put the important point in green color

the important thing is the grammer part i mean to show wether this term is ( verb or noun or adjective etc... )

I need the macro that what ever i write in excel cloumn it bring that in a code like this

<abbr lang="( the words in cloumn should come here)"></abbr>


I will be looking forward to your replies as soon as possible .


Best regards.