Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. using Word.Document's SaveAs Function (VB6)

using Word.Document's SaveAs Function (VB6)

Scheduled Pinned Locked Moved Visual Basic
question
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    reegan41
    wrote on last edited by
    #1

    Hey, I'm trying to save a file with the SaveAs function under the Word.Document... However, if I have a file of the same name, it simply overwrites without giving me a prompt to do so.. Is there any way around this? I checked the list of parameters, and none of them give like, a boolean for 'SaveOverride' or whatever. Thanks. --- reegan41

    T 1 Reply Last reply
    0
    • R reegan41

      Hey, I'm trying to save a file with the SaveAs function under the Word.Document... However, if I have a file of the same name, it simply overwrites without giving me a prompt to do so.. Is there any way around this? I checked the list of parameters, and none of them give like, a boolean for 'SaveOverride' or whatever. Thanks. --- reegan41

      T Offline
      T Offline
      Thomas Chester
      wrote on last edited by
      #2

      According to the SaveAs help documentation the default behaviour is to overwrite without prompting. What you can do is test to see if the file your are going to save as already exists, and then do something to select another name. In the code example below, if the file "c:\test.doc" exists the while loop will try for "c:\test_1.doc". If that file exists, it will then try for "c:\test_2.doc" and so on. Dim I As Long Dim SaveAsFileName As String Dim NewSaveAsFileName As String SaveAsFileName = "c:\Test.doc" NewSaveAsFileName = SaveAsFileName While Dir(NewSaveAsFileName, vbNormal) <> "" I = I + 1 NewSaveAsFileName = Left(SaveAsFileName, Len(SaveAsFileName) - 4) & "_" & i & _ Right(SaveAsFileName, 4) Wend

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups