Log inUsernamePassword
Log me on automatically each visit    
Register
Register
Log in to check your private messages
Log in to check your private messages
Visual Basic Forum for Visual Basic Programmers VB Forum Index » General

Post new topic   Reply to topic
change file path and opening image/excel/word files
View previous topic :: View next topic  
Author Message
zali
Newbie


Joined: 27 Feb 2006
Posts: 3

PostPosted: Mar 5th, 2006 08:57 PM    Post subject: change file path and opening image/excel/word files Reply with quote

hi....I have decided not to store my files in the database as performance may be slower in the future when there are more files....so therefore Im gona save the path of the file instead in the database and save the path in a common network drive...can anyone tell me how do i change the path saved when the dialog box pops up and the user selects what files they want to choose to save? Now I only knw how to save the pathname as it was retrieved from the dialog.....how do I change the pathname to save in another network drive? Right now in order to change the pathname I have a save dialog which follows the first open dialog but thats not what I want as i want to save it all to a common drive..

here are codes i used to attach the file

Private Sub cmdAttachment_Click()
Dim mystring As String
Dim myst As String

On Error GoTo DialogError
With CommonDialog1
.CancelError = True
.Filter = "Text Files (*.txt)|*.txt"
.FilterIndex = 1
.DialogTitle = "Select a file to attach"
.ShowOpen

MsgBox "You have selected " & .FileName


'With CommonDialog1
.CancelError = True
.Filter = "Text Files (*.txt)|*.txt"
.FilterIndex = 1
.DialogTitle = "Select a place to store the file"
.ShowSave
mystring = Trim$(CommonDialog1.FileName)
MsgBox mystring
txtAttach.Text = mystring
m_recRMA!Attachment = mystring
m_recRMA.Update


End With
DialogError:
End Sub

And this is the code to open the file attached...

Dim sExtension As String
Dim iReturnValue As Variant

sExtension = UCase(Right$(txtAttach.Text, 3))

If Dir$(txtAttach.Text) = "" Then
MsgBox "Sorry cannot find file" & vbCrLf _
& "It may b hidden.", vbExclamation
Exit Sub

ElseIf sExtension = "TXT" Then
iReturnValue = Shell("notepad " & txtAttach.Text, 1)

End If

End Sub

If it were a image file or other files like doc/excell how do i open it? The above only works for text files...how do i attach the other file types???? helpppppppp
_________________
The unfortunate, led by the unreliable, asked to to undesirable for the ungrateful
Back to top
View user's profile Send private message Send e-mail MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Visual Basic Forum for Visual Basic Programmers VB Forum Index » General All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Visual Basic Forum runs phpBB | Forum Template © iOptional
VB Resources | SSL | Visual Basic