changing file path and opening exel/word/image file


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: changing file path and opening exel/word/image file

  1. #1
    Join Date
    Feb 2006
    Posts
    5

    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 09:53 PM. Reason: edit title

  2. #2
    Join Date
    Feb 2006
    Posts
    133
    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

  1. Path of the file sent for print
    By Sudeep in forum VB Classic
    Replies: 0
    Last Post: 12-07-2001, 04:48 AM
  2. java path
    By feroz in forum Java
    Replies: 1
    Last Post: 05-03-2001, 10:03 AM
  3. Replies: 3
    Last Post: 05-31-2000, 11:30 AM
  4. component registry and physical file path
    By sreenee in forum VB Classic
    Replies: 2
    Last Post: 05-10-2000, 01:59 AM
  5. How to open a file in a network path
    By rbx99 in forum VB Classic
    Replies: 2
    Last Post: 04-28-2000, 11: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
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center