Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2003
    Posts
    22

    Unanswered: CurrentDIR and filenames.

    Hello,

    I would like a script that.
    - Copy a file
    - Change the new file's name to '2a_manuf'-'2a_artno'.doc (2a_manuf and 2a_artno are field names).

    I also would like a script that opens the file like this:
    curdir\2a\'2a_manuf'-'2a_artno'.doc

    Curdir is where the database is located and the new file should be located in a subdir called 2a. To make it easier to move the database, is there any way that I could use a %curdir% command?

    Thank you!

    lowtek.

  2. #2
    Join Date
    Aug 2003
    Posts
    23
    Maybe this will help

    Dim myPath As String
    Dim file1 As Strin
    Dim file2 As String
    Dim x

    myPath = CurrentProject.Path & "\2a\"
    file1 = myPath & "FileToCopyFrom"
    file2 = myPath & "FileToCopyTo"
    FileCopy file1, file2

    x = Shell("winword """ & file2 & """", vbMaximizedFocus)

    The double "" are needed if there are spaces in the path or filename

    hth

    /Svein Erik

  3. #3
    Join Date
    Aug 2003
    Posts
    22
    Thank you very much. You helped me with the right DIR. But how do I get the file2 to be renamed to '2a_manuf'-'2a_artno'.doc?

    2a_manuf & 2a_artno are field names.

    Private Sub Command44_Click()
    On Error GoTo Err_Command44_Click

    Dim myPath As String
    Dim file1 As String
    Dim file2 As String
    Dim x

    myPath = CurrentProject.Path & "\2a\"
    file1 = myPath & "file1.doc"
    file2 = myPath & "file2.doc"
    FileCopy file1, file2

    x = Shell("winword """ & file2 & """", vbMaximizedFocus)

    Originally posted by kire nievs
    Maybe this will help

    Dim myPath As String
    Dim file1 As Strin
    Dim file2 As String
    Dim x

    myPath = CurrentProject.Path & "\2a\"
    file1 = myPath & "FileToCopyFrom"
    file2 = myPath & "FileToCopyTo"
    FileCopy file1, file2

    x = Shell("winword """ & file2 & """", vbMaximizedFocus)

    The double "" are needed if there are spaces in the path or filename

    hth

    /Svein Erik

  4. #4
    Join Date
    Aug 2003
    Posts
    22
    Never mind. I found a solution

    Tack ändå...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •