943,733 Members | Top Members by Rank

Ad:
Aug 6th, 2009
0

How to open files in my local machine.

Expand Post »
Hi guys .. i wanted to open some of my files. like mswords that save in any of my folders. also wanted to open .txt, .jpg, html etc files.

any code for this..

i have an idea using

shell "location of exe"

but it open exe files only. i wanted to open/preview some of my documents.. any help will be much appreciated.
Similar Threads
Reputation Points: 10
Solved Threads: 1
Junior Poster
jaasaria is offline Offline
123 posts
since Jul 2007
Aug 6th, 2009
1

Re: How to open files in my local machine.

hi,
Try the following code:

[CODE]

'Declare the function to open any type of file

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long


'Declare the variable of FileSytemObject to handle the files
'To get the filesystemobject select the Reference "Microsoft Scripting Runtime"

Dim f As New FileSystemObject
Private Sub Command1_Click()
CommonDialog1.ShowOpen

'To Open the Selecte File

Text1.Text = CommonDialog1.FileName
OpenLocation (gParam_value & Text1.Text)
End Sub


'To Open the Selecte File

Private Function OpenLocation(ByVal WhichFilePath As String, Optional sParams As String = "", Optional sStartIn As String = vbNullString, Optional lngOpenMode As Long = 1) As Long
OpenLocation = ShellExecute(0, "Open", WhichFilePath, sParams, sStartIn, lngOpenMode)
End Function


Have a Great Day
Shailaja



Click to Expand / Collapse  Quote originally posted by jaasaria ...
Hi guys .. i wanted to open some of my files. like mswords that save in any of my folders. also wanted to open .txt, .jpg, html etc files.

any code for this..

i have an idea using

shell "location of exe"

but it open exe files only. i wanted to open/preview some of my documents.. any help will be much appreciated.
Last edited by manoshailu; Aug 6th, 2009 at 8:29 am.
Reputation Points: 34
Solved Threads: 10
Junior Poster
manoshailu is offline Offline
105 posts
since Jun 2007
Aug 8th, 2009
0

Re: How to open files in my local machine.

perfect codes, for what i looking for.

thxx a lot manoshailu.
Reputation Points: 10
Solved Threads: 1
Junior Poster
jaasaria is offline Offline
123 posts
since Jul 2007

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Getting Information in upperCase
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: What is the Advantage and Disadvantage of using Control Array?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC