View Full Version : Excel Opening The Wrong File
I am (still) running xl2003 and WinXP. Applications that have been running without problems for years are suddenly failing.
In many applications, I open an Excel file using VBA from another MS Office program (Word, Outlook, etc) using trypically
Dim xlappl As Excel.Application
Dim xlbook As Excel.Workbook
Dim xlbookname As String
xlbookname = "D:\SomeDir\SomeFileName.xls"
Set xlappl = CreateObject("Excel.Application")
Set xlbook = xlappl.Workbooks.Open (xlbookname, UpdateLinks = False)
Regardless of what file I try to open, xlbook is set to Personal.xls
Any thoughts?
Aflatoon
01-19-2015, 07:24 AM
Are you sure that's the only workbook being opened? If so, is there any code in the Workbook_Open event of your personal macro workbook?
Do you mean that personal.xls is the only file open (Workbooks.Count = 1)
OR
Do you mean that xlbook.Name = "Personal.xls"
Paul_Hossler
01-19-2015, 08:41 AM
Any chance that "D:\SomeDir\SomeFileName.xls" was saved as Hidden or Mininized?
Can you open "D:\SomeDir\SomeFileName.xls" using just Excel?
"Wrong File" or "Not the Right File"? Personal.xlsm in XLSTART is normally opened but hidden
What about
Sub M_snb()
GetObject("D:\SomeDir\SomeFileName.xls").Windows(1).Visible = True
End Sub
Are you sure that's the only workbook being opened? If so, is there any code in the Workbook_Open event of your personal macro workbook?
There is no code in the Workbook_Open event of Personal.xls
Do you mean that personal.xls is the only file open (Workbooks.Count = 1)
OR
Do you mean that xlbook.Name = "Personal.xls"
The latter, i.e., xlbook.Name = "Personal.xls"
Any chance that "D:\SomeDir\SomeFileName.xls" was saved as Hidden or Mininized?
Can you open "D:\SomeDir\SomeFileName.xls" using just Excel?
"Wrong File" or "Not the Right File"? Personal.xlsm in XLSTART is normally opened but hidden
I have been testing this for several days. "D:\SomeDir\SomeFileName.xls" was not saved as hidden or minimized, etc.
Yes, the file opens fine using just Excel and the files opens fine when opened from another open workbook. It is just when a non-Excel application tries to open any Excel file
I am running xl2003, so the personal macro file is Personal.xls, not Personal.xlsm
Could you post a word doc with the code necessary to replicate the issue? Do you happen to have an 'On Error Resume Next' someplace before the snippet you posted in #1?
Mark
Did you test my suggestion as a macro in Word ?
It is just when a non-Excel application tries to open any Excel fileTo be specific. Does this happen when all other applications you have that currently can open excel, do open Excel?
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.