Country_from_URL_macro.txt 19Feb2013 www.BillHowell.ca used with /media/bill/e7a697e3-8b2b-4c53-aa7a-a2c4ec83b050/bill/a_IJCNN2013 Dallas TX/IJCNN13 mass email list.ods Sheet "TargetEmails" REM ***** BASIC ***** Sub Main Dim Doc As Object Dim Sheet As Object Dim Cell1 As Object Dim Cell2 As Object Dim row1 As Integer Dim row2 As Integer Dim col1 As Integer Dim col2 As Integer Dim i As Integer Dim j As Integer Dim String_len As Integer Dim String_inn As String Dim String_out As String REM Doc = ThisComponent REM ThisComponent returns the currently active document. REM The expression Doc.Sheets(0) is a Basic simplification of the API call : Doc.getSheets.getByIndex(0) REM Sheet = Doc.Sheets.getByName("Sheet 1") 'didn't work, but now does!!!?! REM Sheet = Doc.Sheets(0) Doc = ThisComponent Sheet = Doc.Sheets.getByName("TargetEmails") col1 = 4 col2 = col1 + 6 For row1 = 6 To 17690 ' 6 To 17690 row2 = row1 Cell = Sheet.getCellByPosition(col1, row1) Cell2 = Sheet.getCellByPosition(col2, row2) String_inn = Cell.String String_out = "" String_len = len(String_inn) IF String_len > 0 THEN For i = 1 to String_len j = String_len - i + 1 IF mid(String_inn,j,1) = "." THEN j = j + 1 Exit For END IF Next i String_out = mid(String_inn,j,String_len - j + 1) Cell2.String = String_out END IF Next row1 End Sub