Welcome to Tek-Tips.
To do this you will need to use XSLT to translate between the 'native' XML created by Excel (named SpreadsheetML by Microsoft) and the XML demanded by Revenue Canada. XSLT is designed to perform translations from XML to XML, HTML and text.
There are several tools that can help you build XSLT. I prefer Stylus Studio. Others include XML Spy and Cooktop. Cooktop is free, but as with most 'free' things, it requires a bit more effort on your part to make it work. Both Stylus Studio and XML Spy have free evaluation periods. I will tell you the steps using Stylus Studio; YMMV.
Go to the Microsoft web site and download the reference schema for the version of Excel you are using. These schema describe the XML documents produced by MS Excel. Stylus Studio can use the Excel schema directly as an input document for building the XSLT transform. See
as a starting point.
It does not appear that Revenue Canada has an XML schema on its web site for the T4. Perhaps there is one and I just did not find it. However, the web site does provide an example T4 XML submission document. Stylus Studio can use that example document as its output document for building the XSLT transform.
With the input and output document in place, you can use the drag-and-drop XSLT mapper in Stylus Studio to create the mapping from input to output document. The text file thus produced is an XML document that is your XSLT.
You can then use the XSLT directly in Excel to transform the 'native' SpreadsheetML containing your data into a Revenue Canada T4 XML submission document.
This is the general outline of the steps you will need to take. Be sure to consult the help files of whatever products you choose to use, as this is nowhere near a detailed specification of the process. However, if you have problems, please feel free to come back here for help. As you might discern from other threads, specific questions with details are rather quickly and efficiently answered here. Vague questions, however, are not our top priority.
Tom Morrison