Results 1 to 9 of 9
  1. #1
    NejcZ is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2014
    Posts
    17

    Saving Word in new folder

    Hello,
    in my database, I have Word file creating script, which I need to save(Word document) to a specified folder.
    What I have so far:

    Code:
    strsav = "...\novo\dopisi\"
    strmapa = strsav & lastname & "-" & name
    MkDir (strmapa)
    That creates folder just the way I like. Fo saving file I use:

    Code:
    WordApp.ActiveDocument.SaveAs strsav & "Document_" & lastname & "-" & name & ".doc"
    What I want is to put that file in previusly created folder.
    Thanks for your help!

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    You have code that looks like it should do that. What is the issue?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    NejcZ is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2014
    Posts
    17
    I can't get the Word file to save in folder. Any suggestions?
    Also maybe check if folder already exists? Somehow i have problems saving files to server in I try to create folder everytime.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    What is the 'trouble' - error message, nothing happens?

    To check for folder and create if it doesn't exist:

    If Dir(strPath, vbDirectory) = "" Then MkDir strPath
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    NejcZ is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2014
    Posts
    17
    Folder creates, Word document creates outside folder. I can't get it to create inside folder.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    Do a test saving file to folder on your local C drive.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    NejcZ is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2014
    Posts
    17
    I did that. Code I posted obivously can't work. It creates a folder called Lastname-Name
    and file Document_Lastname-Name. I need to combine two parts of code, so that file is created INSIDE folder, if folder does not exist...

  8. #8
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,815
    You can successfully create folder on local C: drive and save document inside that folder?

    You cannot do that on the server?

    I provided example code to check for folder and create. Did you use it?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    NejcZ is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    Jun 2014
    Posts
    17
    Got it solved by redesigning my code, thanks...

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 01-24-2014, 01:21 PM
  2. Replies: 4
    Last Post: 06-27-2013, 12:29 PM
  3. Replies: 2
    Last Post: 03-19-2013, 02:40 PM
  4. Replies: 3
    Last Post: 02-22-2013, 06:41 AM
  5. Replies: 21
    Last Post: 01-24-2012, 06:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums