Try these codes with Microsoft Excel XX Object Library selected under Tools > References in the macro editor.
Dim swApp As SldWorks.SldWorks
Dim swModel As SldWorks.ModelDoc2
Dim xlApp As Excel.Application
Dim xlSheet As Excel.Worksheet
Dim xlBooks As Excel.Workbooks
Set swApp = Application.SldWorks
Set swModel = swApp.ActiveDoc
Set xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
xlApp.Workbooks.Open "File Path here\Filename.xlsx"
Set xlSheet = xlApp.ActiveSheet
XX denotes the excel version based on your MS office installation.
If you need to extract thousands lines of code from the excel using the Excel API may be not good by performance reasons. In this case I would recommend you to use ODBC/OLEDB connection to the Excel document. In this case you may read/write the data very easily even without the Excel installation. Read this KB article: http://support.microsoft.com/kb/257819
Artem Taturevych, Application Engineer at Intercad (Australia)
translationXpert – add-in to translate SolidWorks models
myIntercad – an integrated tool for SolidWorks Professionals