• Prompting user to save a file upon opening up a form in word2003

    Home » Forums » AskWoody support » Productivity software by function » MS Word and word processing help » Prompting user to save a file upon opening up a form in word2003

    Author
    Topic
    #460602

    Hi all,

    I’ve created a form in Word and everytime I click on the *.dot file the form is opened up as Document1.doc default filename.
    I usually save the document with a more representative filename, close the Document1 file and continue editing.

    I really would like to be prompted to Save As… the new document UPON double clicking the *.dot file so I wouldn”t have to face the deletion of Document1 file.

    Can anyone direct me how to add a VBA code to the *.dot file to achieve what I want?
    I tried to do so with a macro as well but couldn’t figured it out.

    I’m using Word2003 running on winXP SP2.

    Thanks for any help!

    -Tivoli0

    Viewing 0 reply threads
    Author
    Replies
    • #1165332

      Do you mean that clicking the .dot file actually saves a document as Document1.doc?
      Normally, (double-)clicking a template starts a new document that hasn’t been saved to disk yet.
      If the new document is saved automatically, the template probably contains VBA code that does this – look for code in the Document_New event procedure in the template’s ThisDocument module, or for a macro named AutoNew in a standard template.
      Or did I misunderstand your description?

      • #1165386

        Hi Hans,

        Thanks for replying!

        You’re right, the Document1 is Being created WITHOUT the saving.

        I was able to get the prompt I was seeking. I entered in the filename.dot file the following code and have the first field in it to use the proc on entry:

        Sub SaveAsNewFile()

        Dim strDocName As String

        strDocName = InputBox(“Please enter the name ” & _
        “of your document.”)
        ActiveDocument.SaveAs FileName:=strDocName

        End Sub

        So all is fine now, but I’m facing another issue now:

        In the filename.dot file’s header I have specified to insert the filename. Although the filename.dot shows its true filename in the its header, the newly created *.doc document shows “Document1”.

        How can I have the newly created document to show my assigned filename?

        Thanks again, Hans, for your assistance!

        -Tivoli0

        • #1165387

          If the new document is created without being saved – as is normal – why would you have to delete a file Document1.doc, as you originally mentioned? I don’t understand where Document1.doc comes from.

          If you have a Filename field in the header, it will initially display Document1 or something similar. Saving the document will not automatically update the field; you must either update all fields, or print preview the document in order to make the field display the actual filename.
          [post=”718738″]Post 718738[/post] contains a macro that you can run to update all fields in a document. You could call this from your SaveAsNewFile macro.

          BTW the SaveAsNewFile macro could be simplified to

          Code:
          Sub SaveAsNewFile()
            Application.Dialogs(wdDialogFileSaveAs).Show
          End Sub
          • #1165389

            Hi Hans,

            <>

            Forget it, I goofed and it was my wrong doing.

            Regarding the updating the field, I got it and will follow your suggestions

            I appreciate your insights and helpfull assistance, Thanks!

            -Tivoli0

    Viewing 0 reply threads
    Reply To: Prompting user to save a file upon opening up a form in word2003

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: