windows vista - Why do Microsoft Office Excel and Word not know how to open files?
2013-11
I have Windows Vista and Office 2007.
Whenever I click on a document such as an Excel or Word document I get this error.
It's annoying as I have to wait for the application to load, get the error and then re-open the file.
Can anyone suggest a solution?
This may be a known bug as Microsoft has a Knowledgebase article about it:
"Cannot find the file" error message when you try to open a workbook by double-clicking the .xls file
- Click Start, and then click Run.
- In the Open box, type
regedit
, and then click OK.- In Registry Editor, locate the following subkey in the registry:
HKEY_CURRENT_USER\Software\Microsoft\Office
- Expand the subkey that corresponds to the earlier version of Excel, and then click the
Excel
subkey.- Right-click the
Excel
subkey, and then clickRename
.- Type
OldExcel
, and then press ENTER.- Repeat steps 4 through 6 for any other subkeys for earlier versions of Excel.
- Locate the following subkey:
HKEY_LOCAL_MACHINE\Software\Microsoft\Office
- Expand the subkey that corresponds to the earlier version of Excel, and then click the
Excel
subkey.- Right-click the
Excel
subkey, and then click Rename.- Type
OldExcel
, and then press ENTER.- Repeat steps 9 through 11 for any other subkeys for earlier versions of Excel.
- Quit Registry Editor.
- Start Excel. (This makes sure that the appropriate registry entries are created.)
- Quit Excel.
- Double-click an .xls file to start Excel and open the workbook.
Whenever I perform certain operations in Word or Excel (2007), these applications are trying to reach the printer. I work on a laptop at work and at home. When I'm at home (not connected to my work's printer), I sometimes have to wait many seconds for Word/Excel to become responsive after performing operations such as making a cell bold in Excel, or pasting a paragraph from a webpage to Word.
In Word I may have a small message at the bottom saying something like "Trying to connect to the printer, press Esc to abort". However 1) That option does not exist in Excel and 2) Sometimes if I do press Esc, Word crashes.
Is there a workaround?
My default printer is the PDF printer installed via CutePDF, which is free :)
As long as I have a local printer defined, and it's default, everything's fine.
I've seen the exact behavior you describe when switching fonts, and I think it's because some printers have allowable fonts, and Word is checking to see if they'll actually render on the printer (though why this is necessary until you actually print is beyond me).
I think the only way to avoid this is by having a default printer that is not remote. Here is a simple JScript that will set your default printer to "Microsoft XPS Document Writer" (assuming you have it installed) which is always a local, non-hardware printer.
var network = new ActiveXObject("WScript.Network");
network.SetDefaultPrinter("Microsoft XPS Document Writer");
Save that as SetDefaultPrinter.js
and you can either run it using the command line:
cscript //nologo SetDefaultPrinter.js
...or you could just save it to your desktop and double-click to run it.
One option would be something like this to automatically switch your printer based on IP address. It presumably could switch to none when you're at home.
It might help to change your default printer to one that is defined locally.
There isn't an obvious (to me at least) rational reason for an application to interact with a printer when changing a font style, but if that is what is happening then at least a local printer won't be across an unconnected network.
You could add a procedure to the ThisWorkbook/ThisDocument
module of your personal.xls/normal.dot that would detect if you were at home and set the printer default appropriately.
I've not tested this, but USERDOMAIN
(index 30) should be suitable for this purpose. The following code should give you a rough idea of what is required to do this.
Sub checkDomain()
Dim desiredPrinter As String
If Environ(30) = "USERDOMAIN=YOURWORKDOMAIN" Then
'Set work default printer
desiredPrinter = "\\NetworkAddress\Work Printer on Ne04:"
Else
'Set home default printer
desiredPrinter = "Microsoft XPS Document Writer on Ne01:"
End If
If Not Application.ActivePrinter = desiredPrinter Then
Application.ActivePrinter = desiredPrinter
End If
End Sub
Note that the ports will likely be different on your PC, you can run the following code to check what VBA thinks your printers are called.
Sub PrinterList()
Dim objWMIService
Dim colInstalledPrinters
Dim objPrinter
Dim strPrinterName As String
Dim strComputer As String
strPrinterName = Application.ActivePrinter
strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colInstalledPrinters = objWMIService.ExecQuery("Select * from Win32_Printer ")
For Each objPrinter In colInstalledPrinters
If objPrinter.PrinterStatus = 1 Or objPrinter.PrinterStatus = 2 Or objPrinter.PrinterStatus = 7 Then
Debug.Print "offline:" & objPrinter.Name
Else
If InStr(strPrinterName, objPrinter.Name) Then
Debug.Print objPrinter.Name & "*"
Else
Debug.Print objPrinter.Name
End If
End If
Next
End Sub
This will list all installed printer names in the Immediate window of the Visual Basic Editor (CTRL+G for the Immediate window if you're not very familiar with VBA)
Whilst you can check the ActivePrinter property in Excel 2007, you can't set it for some reason (even though you can in a Word VBA script). Here's the workaround in Excel VBA:
Set oWord = CreateObject(Class:="Word.Application")
oWord.ActivePrinter = NewDefaultPrinter$
oWord.Quit False
Set oWord = Nothing
It is especially useful to change the default printer if it's currently set to a network printer, as delays are experienced if the VBA macro modifies a workbook (delete columns etc) - it seems to check on the printer with each change made. To prevent this the default printer needs to be set to a local printer during the workbook modification process, then back again afterwards.