|
-
Jun 11th, 2005, 08:00 PM
#1
Thread Starter
Lively Member
Open File (resolved)
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.
Last edited by smart_phil_dude1; Jun 13th, 2005 at 07:55 PM.
Reason: resolved
-
Jun 11th, 2005, 08:13 PM
#2
Fanatic Member
Re: Open File
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
-
Jun 11th, 2005, 09:09 PM
#3
Banned
Re: Open File
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
-
Jun 11th, 2005, 11:01 PM
#4
Re: Open File
no, you need to use the ShellExecute function to open anything (anything with spaces in the name will give shell errors)
-
Jun 13th, 2005, 05:48 PM
#5
Thread Starter
Lively Member
Re: Open File
well, if you put in %20 instead of a space, would it work?
-
Jun 13th, 2005, 07:17 PM
#6
Re: Open File
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
-
Jun 13th, 2005, 07:26 PM
#7
Re: Open File
well actually, cant you wrap it in quotes?
VB Code:
Shell """C:\Windows\System32\MSPaint.exe \Images\myImage.bmp""", vbHide
-
Jun 13th, 2005, 07:54 PM
#8
Thread Starter
Lively Member
Re: Open File
i've tried wrapping in quotes, and it works thnx |2eM!x, ThaRubby, dglienna, and paralinx for you guys' help.
-
Jun 13th, 2005, 08:27 PM
#9
Re: Open File
 Originally Posted by |2eM!x
well actually, cant you wrap it in quotes?
VB Code:
Shell """C:\Windows\System32\MSPaint.exe \Images\myImage.bmp""", vbHide
It works as is. No double quotes needed.
-
Jun 13th, 2005, 08:32 PM
#10
Re: Open File (resolved)
my bad, but it was an example for spaces.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|