Alright, have you ever wondered how to open a file in your application directly from Windows Explorer? Well, I'll show you how, using the "Command$" command.
It's just a few lines of code. I'll explain it as best I can.
In General Declarations put this line of code...
That just gives us a string to hold the File Location. Pretty basic stuff.
Next in the Form_Load() section of your code put this...
Alright, so the "Command$" command loads the Location of the file if "Open With" is used in Windows Explorer. I'm not 100% sure how it works but, I know it loads the location.
But the downfall is, it loads it with quotation marks. ("").
So in order to remove those we use the "Replace" command. Which looks for a certain string inside the String you choose. Now, to find "'s we put (""""), we have to put 2 lots of quotation marks.
Next we merely replace them with "" or nothing.
Where I put "'Do Events" is where you would put the events you want to use the file with.
I hope I have explained this enough. Have fun.
It's just a few lines of code. I'll explain it as best I can.
In General Declarations put this line of code...
Code:
Dim FileLocationName As String
Next in the Form_Load() section of your code put this...
Code:
If Command$ <> "" Then
FileLocationName = Replace(Command$, """", "")
'Do Events
End If
Alright, so the "Command$" command loads the Location of the file if "Open With" is used in Windows Explorer. I'm not 100% sure how it works but, I know it loads the location.
So in order to remove those we use the "Replace" command. Which looks for a certain string inside the String you choose. Now, to find "'s we put (""""), we have to put 2 lots of quotation marks.
Next we merely replace them with "" or nothing.
Where I put "'Do Events" is where you would put the events you want to use the file with.
I hope I have explained this enough. Have fun.




