anixon Posted April 30, 2007 Share Posted April 30, 2007 (edited) I am using this code to open a file Case $msg = $EditSent GUIDelete() $SentFile = FileOpenDialog("Select a File", @ScriptDir & "\DataFiles\Mailed", "Files (*.csv)", 1) If $SentFile = "" Then ExitLoop ShellExecute($SentFile, "", @ScriptDir & "\DataFiles\Mailed\", "edit") ExitLoop The file is saved in .csv Windows Format (created in Excel). The file is associated with Excel (file properties). However my code always opens the file using Notebook when it should be opened using Excel. Why is it so? Help is always appreciated Ant.. Edit Sorry I have answered my own question in ShellExecute($SentFile, "", @ScriptDir & "\DataFiles\Mailed\", "edit") you change "edit" to "open" the code therefore should read ShellExecute($SentFile, "", @ScriptDir & "\DataFiles\Mailed\", "open") Cheers Ant Edited April 30, 2007 by anixon Link to comment Share on other sites More sharing options...
mrbond007 Posted May 1, 2007 Share Posted May 1, 2007 Normally if the file is associated with excel : ShellExecute("filename.csv") should work if not then you have to look at the registry. simply run regedit.exe, scroll in the "HKEY_CLASSES_ROOT" Key and look for sub ".csv" inside it another sub key must be called "Shell" and then "open" and then "command" key. if it is something like "Notepad.exe %1" then you need to modify this entry . sorry if i didn't explain it very well. Projects : Space Regain - Memory Fusion - PWGT - Chip-ITGames : BrainPain - BrainPain Director's Cut - ProSpeed Games Pack (New)Vista vs XP : the forbidden fight Link to comment Share on other sites More sharing options...
Shevilie Posted May 1, 2007 Share Posted May 1, 2007 A workaround is to Execute Excel with the filepath as parameter ShellExecute(PathToExcel.exe PathToFile) Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now