does excel state the file that is opened in the window's title? if so, you sure it doesn't contain anything else in the title? like - Microsoft - Excel. Also does it state the directory of the file opened?
BTW, I think you need to supply Microsoft Excel in the string as well.
Try what I've shown, and report back your results
EDIT, didn't see your response Joe..
BTW, I think you need to supply Microsoft Excel in the string as well.
Try what I've shown, and report back your results
EDIT, didn't see your response Joe..
Sorry for delay response.But nothing change in out put. i use code which is given by you.
Thanks
A good rule to follow when using FindWindow is to include the class name whenever possible. This allows the api to only look for windows matching the class name (and title if specified). When you supply the class name, you increase the chance of finding the correct window. Sure, it's unlikely that any other window will have 'Microsoft Excell' in the title, but it's a good practice to get into. For Excell 2007, the top level window class name is "XLMAIN".
Speaking of Excell 2007, I've noticed that if you open an older spreadsheet (.xls), you'll get "[Compatibility Mode]" as part of the title. If you open the newer spreadsheet format (.xlsx), then this text doesn't appear.
Another interesting thing is that the title text on Excell 2007 seems to appear somewhat reversed with find window compared to how you visually see it.
Visually it appears as "MySheet.xls [Compatibility Mode] - Microsoft Excell", however in code, it appears as "Microsoft Excell - MySheet.xls [Compatibility Mode]". So you'll want to search for the latter.
Bookmarks