how would i be able to make a button on visual basic to open a certain file that is on my computer? what would be the code, etc.
thnx in advance,
Phil.D.
Printable View
how would i be able to make a button on visual basic to open a certain file that is on my computer? what would be the code, etc.
thnx in advance,
Phil.D.
VB Code:
Private Sub Command1_Click() Open C:\Desktop\Visual Basic.txt for Input as #1 Input, strYeaBaby Close #1 End Sub
to save:
VB Code:
Open C:\Desktop\Visual Basic.txt For Append as #1 Print, strYeaBabyGo Close #1
That would open a file and write to it, to open an executable file use the shell funtion.
Shell "C:\Windows\System32\MSPaint.exe", vbHide
no, you need to use the ShellExecute function to open anything (anything with spaces in the name will give shell errors)
well, if you put in %20 instead of a space, would it work?
Nope. VB doesn't know what %20 is.
You can, however, use it if the folder has no spaces:
VB Code:
Shell "C:\Windows\System32\MSPaint.exe \Images\myImage.bmp", vbHide
well actually, cant you wrap it in quotes?
VB Code:
Shell """C:\Windows\System32\MSPaint.exe \Images\myImage.bmp""", vbHide
i've tried wrapping in quotes, and it works :) thnx |2eM!x, ThaRubby, dglienna, and paralinx for you guys' help. :D
Quote:
Originally Posted by |2eM!x
It works as is. No double quotes needed.
my bad, but it was an example for spaces.