-
changing file path and opening exel/word/image file
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
Last edited by zali; 03-05-2006 at 08:53 PM.
Reason: edit title
-
Hi,
with the Commondialog1.filetitle you get the name of the file, so changing the path isn't hard ex.:
Code:
strpath = "c:\tmp\" & Commondialog1.filetitle
Benjamin
Similar Threads
-
By Sudeep in forum VB Classic
Replies: 0
Last Post: 12-07-2001, 03:48 AM
-
Replies: 1
Last Post: 05-03-2001, 09:03 AM
-
Replies: 3
Last Post: 05-31-2000, 10:30 AM
-
By sreenee in forum VB Classic
Replies: 2
Last Post: 05-10-2000, 12:59 AM
-
By rbx99 in forum VB Classic
Replies: 2
Last Post: 04-28-2000, 10:25 AM
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
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks