• Hyperlink opens form to .dot (Word 97)

    Author
    Topic
    #399309

    I seem to hit brick walls at every step of my project!!

    I have set Hyperlinks in my document to open a form that is a Word Template. The trouble is that I dont want the users to open the actual template as a .dot file – I want them to be opened as .doc files.

    Any ideas?

    Kerry

    Viewing 3 reply threads
    Author
    Replies
    • #770226

      Edited – Note edit in code (added backslash) shown in red

      I’m not sure exactly what you’re wanting to do here, Kerry. But I’m guessing that you want the user to be able to click some text that says something like “Click here to create a new XYZ document”. If this is the case, you’re wanting to run a macro, rather than open an existing file. The macro code would look something like this:

      Sub NewXYZDoc()

      Documents.Add Template:= _
      “C:WINDOWSApplication DataMicrosoftTemplatesXYZ.dot”, _
      NewTemplate:=False, DocumentType:=0

      End Sub

      I’m not sure how to make this more “general”, so that the correct template path would be found on the user’s machine. Another guess (should work) is to replace the path above with
      Options.DefaultFilePath(wdUserTemplatesPath), so you’d use something like:

      Dim XYZRef
      XYZRef = Options.DefaultFilePath(wdUserTemplatesPath) & “XYZ.dot”
      Documents.Add Template:= _
      XYZRef, NewTemplate:=False, DocumentType:=0

      And I’m not sure if you can run a macro from a hyperlink. But you certainly can from a MACROBUTTON field, like the one I included in the DocVarDemo1.dot example I posted (but the user will need to double-click this kind of link).

      Brickwalls are what it’s all about grin. Enjoy brickwall.

      Alan

      • #770289

        Alan you need a medal – you are so patient with me.

        Andrew has understood my problem – but as you will see by my response to him, I still have problems. Also the files are not placed in the user templates location. They are in a folder called Forms as part of the compilation that makes up my project. Which will then be placed on 10 different servers.

        Kerry

        Kerry

        • #770359

          In that case, assuming your “Forms” folder is a child folder of the folder containing the document with the link, then

          XYZRef = ActiveDocument.Path & Application.PathSeparator & _
          “Forms” & Application.PathSeparator & “XYZ.dot”

          should work in the code I gave. If it’s some other folder structure, things might get stickier.

          Alan

        • #770360

          In that case, assuming your “Forms” folder is a child folder of the folder containing the document with the link, then

          XYZRef = ActiveDocument.Path & Application.PathSeparator & _
          “Forms” & Application.PathSeparator & “XYZ.dot”

          should work in the code I gave. If it’s some other folder structure, things might get stickier.

          Alan

      • #770290

        Alan you need a medal – you are so patient with me.

        Andrew has understood my problem – but as you will see by my response to him, I still have problems. Also the files are not placed in the user templates location. They are in a folder called Forms as part of the compilation that makes up my project. Which will then be placed on 10 different servers.

        Kerry

        Kerry

      • #770363

        I foound this code in Jefferson’s post post 130411. The code at the bottom of the post ALMOST works.

        I dont know where I should add it in a form?

        Also it crashes on Word 97 but clunks through on Word 2002.

        I think with some work, we might be able to get it working. Well – maybe – I live in hope!

        • #770373

          Maybe Jefferson could best answer that. grin Another post (the attachment) that may be of significance is post 261488 (where are you Macropod?) Again, I haven’t looked at the details though.

          Alan

        • #770374

          Maybe Jefferson could best answer that. grin Another post (the attachment) that may be of significance is post 261488 (where are you Macropod?) Again, I haven’t looked at the details though.

          Alan

        • #770694

          With Jefferson’s VBA code you don’t load it in your form. It should go in another module. You might already have an AutoNew macro sitting in there which calls the user form you have been playing with. This might cause some problems as I don’t know whether the AutoNew macro will run before or after the AutoOpen macro and this will take some nutting out for you.

          I would expect the AutoOpen macro to run when the template is OPENED and then when the new document is created, both macros will run (but in which order).

        • #770695

          With Jefferson’s VBA code you don’t load it in your form. It should go in another module. You might already have an AutoNew macro sitting in there which calls the user form you have been playing with. This might cause some problems as I don’t know whether the AutoNew macro will run before or after the AutoOpen macro and this will take some nutting out for you.

          I would expect the AutoOpen macro to run when the template is OPENED and then when the new document is created, both macros will run (but in which order).

        • #770758

          No wonder my ears were burning. grin

          If you place the AutoOpen macro in a code module in the template you are linking to, it should activate when the user clicks the link and opens the template.

          In the future, to edit that template, hold the shift key when opening it to temporarily deactivate the AutoOpen macro.

          • #770799

            Ahh – its esp!

            Thanks Jefferson.

            I have so many issues happening at the moment – I am in a spin. The help from this forum is so great, I am like a kid in a lolly shop! I will have to slow down and work through one at a time.

            Bye for now
            Kerry

          • #770800

            Ahh – its esp!

            Thanks Jefferson.

            I have so many issues happening at the moment – I am in a spin. The help from this forum is so great, I am like a kid in a lolly shop! I will have to slow down and work through one at a time.

            Bye for now
            Kerry

        • #770759

          No wonder my ears were burning. grin

          If you place the AutoOpen macro in a code module in the template you are linking to, it should activate when the user clicks the link and opens the template.

          In the future, to edit that template, hold the shift key when opening it to temporarily deactivate the AutoOpen macro.

      • #770364

        I foound this code in Jefferson’s post post 130411. The code at the bottom of the post ALMOST works.

        I dont know where I should add it in a form?

        Also it crashes on Word 97 but clunks through on Word 2002.

        I think with some work, we might be able to get it working. Well – maybe – I live in hope!

    • #770227

      Edited – Note edit in code (added backslash) shown in red

      I’m not sure exactly what you’re wanting to do here, Kerry. But I’m guessing that you want the user to be able to click some text that says something like “Click here to create a new XYZ document”. If this is the case, you’re wanting to run a macro, rather than open an existing file. The macro code would look something like this:

      Sub NewXYZDoc()

      Documents.Add Template:= _
      “C:WINDOWSApplication DataMicrosoftTemplatesXYZ.dot”, _
      NewTemplate:=False, DocumentType:=0

      End Sub

      I’m not sure how to make this more “general”, so that the correct template path would be found on the user’s machine. Another guess (should work) is to replace the path above with
      Options.DefaultFilePath(wdUserTemplatesPath), so you’d use something like:

      Dim XYZRef
      XYZRef = Options.DefaultFilePath(wdUserTemplatesPath) & “XYZ.dot”
      Documents.Add Template:= _
      XYZRef, NewTemplate:=False, DocumentType:=0

      And I’m not sure if you can run a macro from a hyperlink. But you certainly can from a MACROBUTTON field, like the one I included in the DocVarDemo1.dot example I posted (but the user will need to double-click this kind of link).

      Brickwalls are what it’s all about grin. Enjoy brickwall.

      Alan

    • #770259

      This question gets asked pretty often so if you have a search in this forum you should find some useful information.

      This should get you started – Post 292412

      • #770282

        Andrew you have hit the nail on the head in understanding my problem and your solution would be great except for one major issue.

        These templates are part of a complete electronic manual. I have 9 Chapters in separate files all of which have their own table of contents. The forms are referred to in hyperlinks throughout the chapters. Due to the limitations of our departmental network, the complete bundle will be placed on 10 different snap servers. Hence the lack of “relativity” poses a major problem.

        brickwall I live in hope!!

        Kerry

      • #770283

        Andrew you have hit the nail on the head in understanding my problem and your solution would be great except for one major issue.

        These templates are part of a complete electronic manual. I have 9 Chapters in separate files all of which have their own table of contents. The forms are referred to in hyperlinks throughout the chapters. Due to the limitations of our departmental network, the complete bundle will be placed on 10 different snap servers. Hence the lack of “relativity” poses a major problem.

        brickwall I live in hope!!

        Kerry

    • #770260

      This question gets asked pretty often so if you have a search in this forum you should find some useful information.

      This should get you started – Post 292412

    Viewing 3 reply threads
    Reply To: Hyperlink opens form to .dot (Word 97)

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

    Your information: