Opening Excel 2007 using Excel 2003

  • Thread starter Thread starter grace
  • Start date Start date
G

grace

Issue 1:

If I take a Excel 2007 file saved with a "xlsx" file extension and I
manually change the filename extension to "xls", then I open the Excel file
using Excel 2003, it displays the following popup message to the user:

"This file is not in a recognizable format.
- If you know the file is from another probram which is incompatible with
Microsoft Office Excel, click Cancel, then open this file in its original
application. If you want to open the file later in Microsoft Office Excel,
save it in a format that is compatible, such as text format.
- If you suspect the file is damaged, click Help for more information about
solving the problem.
- If you still want to see what text is contained in the file, click OK.
Then click Finished in the Text Import Wizard."


This popup has an "OK" button and "Cancel" button which the user will need
to click on either of the buttons first before the Excel file is opened.

How do I stop this popup message from appearing as we do not want any human
interactions performed before the Excel file is opened?
_____________________________________________________________________

Issue 2:

When opening Excel 2007 files using Excel 2003, it displays the following
popup message to the user:

"This file was created in a newer version of Microsoft Excel. The file has
been converted to a format you can work with, but the following issues were
encountered. The file has been opened in read-only mode to protect the
original file.

- Some formulas in this workbook contain functions with more arguments than
are supported by this version of Excel. Formulas with more than 30 arguments
to a function will not be opened and will be converted to #VALUE! errors.
- Some formulas in this workbook use more operands than are allowed by this
version of Excel. These formulas will not be opened and will be converted to
#VALUE! errors."

This popup has an "OK" button which the user will need to click on before
the Excel file is opened.

How do I stop this popup message from appearing as we do not want any human
interactions to occur when an Excel file is opened?

_____________________________________________________________________

Please note that Issue #1 is more important for us so if this can be
resolved first, that will be great. Thank you.
 
The easiest way is to save the 2007 document as a 2003 file :) Then all
problems go away. If someone send it to you, ask them to save it as a 2003
file
Have the same problem at work, some have upgraded to 2007, and some have
2003 still.
 
Yes, that is the easiest way but we need to handle the case when users submit
a 2007 Excel file to us. We are using Excel 2003 on one of the server and we
have a batch program on this server that opens the Excel file to perform some
tasks. Therefore, we need the ability to open the Excel 2007 file submitted
to us using Excel 2003 without receiving any popup messages. If you have any
other suggestions to handle this case, that will be great.

Thank you.
 
We have installed the converter and all the High-Priority updates from
Microsoft Update as indicated in the link below. We are still receiving the
popup messages indicated in both issue 1 and issue 2 when opening Excel 2007
files using Excel 2003. Do you have any other suggestions?

Thank you
 
Possible solution

http://social.microsoft.com/Forums/en-US/Offtopic/thread/91e3e92c-200e-4cb5-b784-4bb2ae343fa6

Quoting from that article:

"
By the way i found an alternative solution and would like to share it here :)
Call Shell("C:\Program Files\Microsoft Office\Office12\Moc.exe " & "C:\Book1.xlsx")

*Moc.exe is Open XML format converter provided after Office 2007 Compatibility Pack installed.


The Office 2007 Compatibility Pack will do the conversion job 1st before proceed to open the converted file (in temp folder). If the xlsx file is being open via [Excel 2003 > File > Open], it will be the same issue as via programmatically.
"

This at least opens up the file without having to hit the 'OK' button.
 
Full code for programmatically reading in Excel 2007 and processing

Here is the code I've got.

I've grafted some other code here that does a wait until the conversion is actually *done*.

The code here was to extract all the images from an Excel 2007 file.

Note well - if you try running the converter on an Excel 2003 file and the file has macros, you are asked (with a popup!) if you want to open the macros!

So, the converter will work if you have only Excel 2007 files, with a .xlsx extension (a .xls extension confuses matters - give it a whirl).

Code:
' Headers/declarations
 
 Option Explicit
 Dim ExcelApp As Object
 Dim ExcelWorkbook As Object
 
 Private Declare Function OpenProcess Lib "kernel32" _
 (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, _
 ByVal dwProcessId As Long) As Long
 
 Private Declare Function GetExitCodeProcess Lib "kernel32" _
 (ByVal hProcess As Long, lpExitCode As Long) As Long
 
 Private Const STATUS_PENDING = &H103&
 Private Const PROCESS_QUERY_INFORMATION = &H400
 
 '
 
 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 '
 ' Process entire Excel file and extract plots from charts and worksheets
 '
 ' This can be done from a machine running VB with Excel 2003
 ' that will read Excel 2007 files (.xlsx).
 '
 ' It uses the Microsoft Moc.exe utility (which is installed when the MS file
 ' converter is installed) to convert and open up the .xlsx *without* the
 ' pesky popup.
 '
 ' Use at your own risk.
 ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
 Sub ProcessExcelFile(sFullPathAndFileName As String)
 
 On Error GoTo ehandler:
 
 Dim ExcelApp As Object
 Dim ExcelWorkbook As Object
 Dim ICnt As Integer
 Dim Start As Single
 Dim i As Integer
 Dim j As Integer
 Dim sType As String
 
 Dim Worksheet_Count As Integer
 
 ' PNG, GIF, JPG
 sType = "PNG"
 
 Start = Timer
 
 Set ExcelApp = CreateObject("Excel.Application")
 
 ' Note in using Excel 2003 files:
 ' To open workbook *directly* (if you knew the file was an Excel 2003 format)
 ' instead of using the ShellAndWait
 '
 ' Set ExcelWorkbook = ExcelApp.Workbooks.Open(sFullPathAndFileName)
 '
 ' You would convert things like ExcelApp.Activeworkbook.ActiveSheet.Name to
 ' ExcelWorkbook.ActiveSheet.Name
 '
 ' You can't seem to use the ShellandWait method, because Excel will open the file, but ShellAndWait will
 ' only continue *after* the Excel application is shut down!
 '
 
 
 ' this opens a workbook (Excel 2007)
 Call ShellandWait("C:\Program Files\Microsoft Office\Office12\Moc.exe " & sFullPathAndFileName)
 
 
 Debug.Print ExcelApp.ActiveWorkbook.Name
 
 ExcelApp.Visible = False
 
 
 	' Begin the loop through all CHARTS in the workbook
 	For i = 1 To ExcelApp.ActiveWorkbook.Charts.Count
 	
 	   ' Select the chart
 	   ExcelApp.ActiveWorkbook.Charts(i).Select
 	   
 '	   Debug.Print "--->" & ExcelApp.ActiveWorkbook.ActiveSheet.Name
 '	   Debug.Print "--->" & ExcelApp.ActiveWorkbook.ActiveSheet.ChartObjects.Count
 	   
 		' single chart
 		' Extract the *entire* chart as a single JPG
 		ExcelApp.ActiveWorkbook.ActiveChart.Export FileName:=CurDir & "\output\" & _
 			ExcelApp.ActiveWorkbook.ActiveChart.Name & "." & sType, FilterName:=sType
 	   
 	   ' Extract individual charts, if they exist
 	   For j = 1 To ExcelApp.ActiveWorkbook.ActiveSheet.ChartObjects.Count
 	   
 	   ExcelApp.ActiveWorkbook.ActiveSheet.ChartObjects(j).Chart.Export FileName:=CurDir & "\output\" & _
 			ExcelApp.ActiveWorkbook.ActiveChart.Name & _
 		   "_plot" & Format(j, "000") & "." & sType, FilterName:=sType
 	   
 	   Next j
 	   
 	Next i
 	
 	' Begin the loop through all WORKSHEETS in the workbook
 	For i = 1 To ExcelApp.ActiveWorkbook.Worksheets.Count
 	
 	   ' Select the chart
 	   ExcelApp.ActiveWorkbook.Worksheets(i).Select
 	   
 '	   Debug.Print "--->" & ExcelApp.ActiveWorkbook.ActiveSheet.Name
 '	   Debug.Print "--->" & ExcelApp.ActiveWorkbook.ActiveSheet.ChartObjects.Count
 	
 	   ' Extract individual charts, if they exist
 	   For j = 1 To ExcelApp.ActiveSheet.ChartObjects.Count
 	   
 	   ExcelApp.ActiveWorkbook.ActiveSheet.ChartObjects(j).Chart.Export FileName:=CurDir & "\output\" & _
 			ExcelApp.ActiveWorkbook.ActiveSheet.Name & _
 		   "_plot" & Format(j, "000") & "." & sType, FilterName:=sType
 	   
 	   Next j
 	   
 	Next i
 		 
 
 ExcelApp.ActiveWorkbook.Close SaveChanges:=False
 
 ExcelApp.Quit
 
 MsgBox "Done; it took " & Timer - Start & " seconds."
 
 Exit Sub
 
 ehandler:
 
 MsgBox "Error = " & Error
 
 End Sub
 
 
 
 
 Private Sub cmdProcessExcel_Click()
 
 Call ProcessExcelFile("c:\test\test_03.xlsx")
 
 
 End Sub
 
 Public Function ShellandWait(ExeFullPath As String, _
 Optional TimeOutValue As Long = 0) As Boolean
 	
 	Dim lInst As Long
 	Dim lStart As Long
 	Dim lTimeToQuit As Long
 	Dim sExeName As String
 	Dim lProcessId As Long
 	Dim lExitCode As Long
 	Dim bPastMidnight As Boolean
 	
 	On Error GoTo ErrorHandler
 
 	lStart = CLng(Timer)
 	sExeName = ExeFullPath
 
 	'Deal with timeout being reset at Midnight
 	If TimeOutValue > 0 Then
 		If lStart + TimeOutValue < 86400 Then
 			lTimeToQuit = lStart + TimeOutValue
 		Else
 			lTimeToQuit = (lStart - 86400) + TimeOutValue
 			bPastMidnight = True
 		End If
 	End If
 
 	lInst = Shell(sExeName, vbMinimizedNoFocus)
 	
 lProcessId = OpenProcess(PROCESS_QUERY_INFORMATION, False, lInst)
 
 	Do
 		Call GetExitCodeProcess(lProcessId, lExitCode)
 		DoEvents
 		If TimeOutValue And Timer > lTimeToQuit Then
 			If bPastMidnight Then
 				 If Timer < lStart Then Exit Do
 			Else
 				 Exit Do
 			End If
 	End If
 	Loop While lExitCode = STATUS_PENDING
 	
 	ShellandWait = True
    
 ErrorHandler:
 ShellandWait = False
 Exit Function
 End Function
 
1) Uninstall the converter if its already installed
2) Install Office 2003 Service Pack 3
3) Install the converter


If the above doesn't work, then
1) Uninstall Office 2003
2) Uninstall the converter
3) Install Office 2003
4) Install Office 2003 Service Pack 3
5) Install the converter
 
Back
Top