Jump to content

Recommended Posts

Posted (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 by anixon
Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...