My problem is that when I try your examples or any other I've found I get errorS, I think from the fact that "RangeTwo" is already defined as a string.
Here is the rest of my code (scooped from this site, modified by me):
Sub MakeXML2() ' create an XML file from an Excel table
Dim MyRow As Integer, MyCol As Integer, Temp As String, DefFolder As String
Dim XMLFileName As String, XMLRecSetName As String, RTC1 As Integer
Dim RangeOne As String, RangeTwo As String, Tt As String, FldName(99) As String
DefFolder = "C:\" 'File Location
XMLFileName = "XMLFileName.xml" 'File Name
XMLRecSetName = "record"
RangeOne = "A1:E1" 'Field Names
MyRow = MyRng(RangeOne, 1)
For MyCol = MyRng(RangeOne, 3) To MyRng(RangeOne, 4)
FldName(MyCol - MyRng(RangeOne, 3)) = FillSpaces(Cells(MyRow, MyCol).Value)
Next MyCol
RangeTwo = "A2:E11" 'Data Range <<<<<<< LINE IN QUESTION!!!
RTC1 = MyRng(RangeTwo, 3)
XMLFileName = DefFolder & XMLFileName
Open XMLFileName For Output As #1
Print #1, "<?xml version=" & Chr(34) & "1.0" & Chr(34) & " encoding=" & Chr(34) & "ISO-8859-1" & Chr(34) & "?>"
Print #1, "<hip2b2>"
For MyRow = MyRng(RangeTwo, 1) To MyRng(RangeTwo, 2)
Print #1, "<" & XMLRecSetName & ">"
For MyCol = RTC1 To MyRng(RangeTwo, 4)
' the next line uses the FormChk function to format dates and numbers
Print #1, "<" & FldName(MyCol - RTC1) & ">" & RemoveAmpersands(FormChk(MyRow, MyCol)) & "</" & FldName(MyCol - RTC1) & ">"
' the next line does not apply any formatting
'Print #1, "<" & FldName(MyCol - RTC1) & ">" & RemoveAmpersands(Cells(MyRow, MyCol).Value) & "</" & FldName(MyCol - RTC1) & ">"
Next MyCol
Print #1, "</" & XMLRecSetName & ">"
Next MyRow
Print #1, "</hip2b2>"
Close #1
End Sub
Thanks in advance
a