Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Star Lounger
    Join Date
    May 2001
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Macro for opening folder (Word 2000 SR3)

    Hi All

    I am looking to create a macro that opens a folder to allow the user to choose the file they want from within it. I know this must be fairly easy but am having one of those days and can only get it to work if I choose a file from within the folder. Any help would be much appreciated

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro for opening folder (Word 2000 SR3)

    The instruction to change to another folder is ChangeFileOpenDirectory "C:Path" (substitute the appropriate path). You can then present the Open File dialog with Dialogs(wdDialogFileOpen).Show.

  3. #3
    Star Lounger
    Join Date
    May 2001
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro for opening folder (Word 2000 SR3)

    Thanks that worked a treat. Is there a similar command for File New. The scenario I am trying to create is a menu for the templates in the firm by department and I dont want anyone opening the templates I need it to be as if they had gone into File New and selected it. So basically they will click on a menu with a number of departments listed and when they click on the dept I want them to access the Files but as templates so they launch as a document and dont open as the selected template.

    I hope that makes sense. Any help would be much appreciated

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro for opening folder (Word 2000 SR3)

    You should set the User Templates and/or Workgroup Templates paths for this; the File | New dialog is very different from the File | Open dialog: you can't navigate to other folders, only to the various tabs in the dialog. And unless you uninstall the Microsoft templates, they will always be displayed.

    To get/set the User Templates path in code, use Options.DefaultFilePath(wdUserTemplatesPath), and to get/set the Workgroup Templates path, use (you guessed it) Options.DefaultFilePath(wdWorkgroupTemplatesPath).

  5. #5
    Star Lounger
    Join Date
    May 2001
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro for opening folder (Word 2000 SR3)

    Again this works perfectly so thanks - only problem is it is bringing in tabs for Legal Pleadings, Letters and Faxes etc that I don't want - I only want to show the templates in the folder I have set. Is there a way to do this.

    thanks for your help

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro for opening folder (Word 2000 SR3)

    I think that the only way to get rid of these tabs is to uninstall the templates that come with Word.
    Open the Add/Remove Programs control panel.
    Select Microsoft Office or Microsoft Word, depending on how you installed Word.
    Indicate that you want to modify the existing installation.
    Clear the check box for the templates.

    This will have to be done for each PC...

  7. #7
    Star Lounger
    Join Date
    May 2001
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro for opening folder (Word 2000 SR3)

    Is there any way, other than setting the file new path, to have the documents displayed opened as templates - ie as docX rather than the file name as read only. I need the users to be able to choose from the list but for it to open as a template if possible
    Thanks in advance

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Macro for opening folder (Word 2000 SR3)

    It is possible to use VBA code to display a list of files, then create a new document based on the document selected by the user. The user would have to use a custom toolbar button or menu item instead of File | New...
    I don't know how familiar you are with writing VBA code for Word.

  9. #9
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro for opening folder (Word 2000 SR3)

    Hi Boyley:
    I'm curious as to what you're trying to accomplish. Normally, you would simply have a list of templates & users would open a document based on them. I can't think of a reason why you would want users to open a template, rather than a document based on that template.
    Cheers,

  10. #10
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Macro for opening folder (Word 2000 SR3)

    Following Hans' suggestion, try something along these lines:

    <pre>Sub FileNewUsingFileOpenDlg()
    Dim strStartPath As String, docNew As Document
    strStartPath = "serversharefolder" 'Change this to fit your servername pathfolder
    ChangeFileOpenDirectory strStartPath
    With Dialogs(wdDialogFileOpen)
    If .Display = True Then
    Set docNew = Documents.Add(Template:= _
    Options.DefaultFilePath(wdCurrentFolderPath) & _
    Application.PathSeparator & Replace(.Name, """", ""), _
    Visible:=True)
    docNew.Activate
    Set docNew = Nothing
    End If
    End With
    End Sub</pre>

    What it does is show the File Open dialog and, if the user chooses Open, feeds the path and file name to the function that creates a new document from what the user chose. By default, Word will shows both DOC and DOT files (and HTM, RTF, etc.), but it should be possible to change this by passing a .Name parameter to the dialog.

  11. #11
    Star Lounger
    Join Date
    May 2001
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro for opening folder (Word 2000 SR3)

    The scenario is I have 7 departments - I am creating 7 Normal.dots, one for each department - I want to have a menu on the toolbar that when accessed has 3 options

    1. the department templates for the department they are in - and only display that department
    2. other department templates - should they need them
    3. general templates - fax, memo etc

    In each case I want them to be opened as templates not documents. I am sure there is an easier way to do it but this is they way I have in my head and am playing around with it to get it to work.

    Hope this makes sense.

  12. #12
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Macro for opening folder (Word 2000 SR3)

    > In each case I want them to be opened as templates not documents.

    This statement is confusing (at least to me). It's better to say whether you want File>New behavior, which generates a new document and doesn't open the chosen template, or File>Open behavior, which opens the file. Based on the above, I think you want the File>New behavior. Hopefully the macro will help.

  13. #13
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro for opening folder (Word 2000 SR3)

    Hi Boyley:
    I really think that what you need is to create a new document from the templates, not open the templates. You can place styles, Autotext entries, shortcut keys, macros, boilerplate text & toolbars in your various templates. These will all be available when you create a new document based on one of those templates.

    You can create a toolbar that lists all the department templates in a dropdown menu. Another toolbar can list other department templates. You can create such "flyout" menus by using Tools/Customize.../Commands tab & look for New Menu at the bottom. You can drag this to a toolbar or to a new menu on the toolbar.

    Then you can keep all the templates in your Workgroup Templates Folder. If you allow each Department to open the templates, then anyone can modify your template...destroy your macros, change the styles, etc. Then the next person won't be able to use it.

    I've attached an example of a template with such a toolbar, but, of course, it doesn't point to any templates.
    Attached Files Attached Files

  14. #14
    Star Lounger
    Join Date
    May 2001
    Posts
    50
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro for opening folder (Word 2000 SR3)

    My language here was the problem - I dont want them to open as a template, i do need them to open as a document. Each department will have thier own normal.dot from which they will launch thier department styles. In Normal.dot but I want to create a menu entry such as "Corporate Styles" that when you click on will open up a dialog box where the styles can be chosen and opened as if you had gone into file new - in this box there would be no other templates available other than those required for the corporate dept - these would be in tabs again (as the styles are stored in folders) as if they were in file new. the structure is

    Corporate Styles (folder)
    Styles 1 (subfolder)
    Styles 2 (subfolder)
    Styles 3 (subfolder)
    Styles 4 (subfolder)
    Styles 5 (subfolder)
    Styles 6 (subfolder)

    The folders are set up on the network with each department having their own folder with subfolders, Litigation styles, Property styles etc.

    Some departments need access to other department styles occasionally so in the same menu there might be Litigation styles where when clicked on the same scenario as the first would occur - a box with only litigation styles in it. I cant list them individually as some departments have hundreds of styles. This might not be able to be done or be too difficult for me to try but it is ideally the way I would like users to be able to work

  15. #15
    Uranium Lounger
    Join Date
    Dec 2000
    Location
    Los Angeles Area, California, USA
    Posts
    7,453
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Macro for opening folder (Word 2000 SR3)

    Hi Boyley:
    I'm not sure that I know how to do what you want. It appears that you are copying styles into a document when you list:
    Corporate Styles (folder)
    Styles 1 (subfolder)
    Styles 2 (subfolder)
    Styles 3 (subfolder)
    Styles 4 (subfolder)
    Styles 5 (subfolder)
    Styles 6 (subfolder)

    However, styles are found in templates & documents. The Styles 1, etc. that you've listed would either have to be a macro to create &/or copy those styles from another template. If those "style" templates exist, all you have to do is create a document based on them & the styles will be available.

    I suppose that a macro which opened the Format/Theme.../Style Gallery dialog box, picked a particular template, & then copied the styles would do what you're asking, but I'm afraid I'm not a VBA expert. Still, I don't see any advantage to that method over creating a new document based on the correct template. You can do that with the toolbar dropdown menu that I showed you in <post#=332176>post 332176</post#>.

    The advantage to a new document based on a template is that you can have special autotext that would only apply to litigation, property, etc. in a given template.
    Hope this helps,

Page 1 of 2 12 LastLast

Posting Permissions

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