Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Page Layout / April 2008

Tip: Looking for answers? Try searching our database.

Show Folder index list in word document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
lorne17 - 22 Apr 2008 20:24 GMT
Hello there,

I am trying to figure out if it is possible to place a folder index
list or table of contents showing the files in a specific folder.  We
have a folder full of video tutorials and would like to have a word doc
that shows these files in a list.  But if we add a video we want that
list to update automatically.

And if that isn't enough, can I have them linked so when clicked I can
view it?

thanks,
Lorne

Signature

lorne17

Doug Robbins - Word MVP - 22 Apr 2008 23:32 GMT
See the article "Insert into a document the names of all files in a selected
folder" at:

http://www.word.mvps.org/FAQs/MacrosVBA/InsertFileNames.htm

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Hello there,
>
[quoted text clipped - 9 lines]
> thanks,
> Lorne
lorne17 - 23 Apr 2008 16:09 GMT
I'm lost on what that link is showing?  It's all coding and well I don't
know WORD coding.  Any other methods on how to do this?  Thanks for the
help.

Lorne

PS-What does this mean: "Please reply to the newsgroup unless you wish
to avail yourself of my services on a paid consulting basis"

Doug Robbins - Word MVP;2736169 Wrote:
> See the article "Insert into a document the names of all files in a
> selected
[quoted text clipped - 17 lines]
> thanks,
> Lorne

Signature

lorne17

Doug Robbins - Word MVP - 24 Apr 2008 04:45 GMT
See the article "What do I do with macros sent to me by other newsgroup
readers to help me out?" at:

http://www.word.mvps.org/FAQs/MacrosVBA/CreateAMacro.htm

Reur PS, it means that you should reply to the newsgroup with any additional
questions UNLESS you wish to engage me to provide assistance to you
personally on a pay for hire basis.  My contributions to the newsgroups are
free.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> I'm lost on what that link is showing?  It's all coding and well I don't
> know WORD coding.  Any other methods on how to do this?  Thanks for the
[quoted text clipped - 27 lines]
>> thanks,
>> Lorne
lorne17 - 24 Apr 2008 16:02 GMT
Ok,

This worked great.  But is there a way to have this list updated
automatically?  It is really what we're needing.

Thanks,

Lorne

Doug Robbins - Word MVP;2738261 Wrote:
> See the article "What do I do with macros sent to me by other newsgroup
>
[quoted text clipped - 8 lines]
> are
> free.

Signature

lorne17

Doug Robbins - Word MVP - 24 Apr 2008 23:28 GMT
It can only be updated by deleting the existing list and running the macro
again.  How automatic do you need to make it?

While you could create a macro that ran automatically when the document was
opened, there must be some way of identifying the location of the existing
list so that the macro can delete it and replace it.

One way would be to have the list created inside a one cell table (without
borders if desired)

If that table was the first table in the document, adding the following code
at the beginning of the macro would delete the contents of that table and
replace it with an updated list

ActiveDocument.Tables(1).Cell(1, 1).Select
Selection.Delete

I would recommend that you save this document as a template, and create the
macro in the template and change its name to Sub Autonew()

Then when you create a document from that template, the list will be updated
each time.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Ok,
>
[quoted text clipped - 18 lines]
>> are
>> free.
lorne17 - 25 Apr 2008 18:00 GMT
Ok,

Adding the new code to the macro worked.  A couple issues though:

-It's not automatic when I open the file.  How do I make it automatic?
-How can I change my coding to automatically select a folder path?  Not
have the user select it (our folder location won't be changing).
-Also, can I have this list be linked to each individual file?  That
way if the user clicks the name of the file, it will open that file.
-Have a set font/size for list? (is this part of the macro coding?)

Am I asking to much?  It would be really nice for this to be this way
and not have to worry about it for future users in this file.

Thanks so much for your help and patience.

Lorne

Doug Robbins - Word MVP;2739908 Wrote:
> It can only be updated by deleting the existing list and running the
> macro
[quoted text clipped - 26 lines]
> updated
> each time.

Signature

lorne17

Doug Robbins - Word MVP - 26 Apr 2008 10:22 GMT
Like I said, I would recommend that you save this document as a template,
and create the
macro in the template and change its name to Sub Autonew()

Then when you create a new document from that template, the macro will run.

To hard code the folder location, replace

'let user select a path
With Dialogs(wdDialogCopyFile)
   If .Display() <> -1 Then Exit Sub
   MyPath = .Directory
End With

'strip quotation marks from path

If Len(MyPath) = 0 Then Exit Sub

If Asc(MyPath) = 34 Then
   MyPath = Mid$(MyPath, 2, Len(MyPath) - 2)
End If

with

MyPath = "Drive:\Folder\"

If you save the document as a template as I recommend, then you could also
have a macro in that template that opened the selected file

Dim myfile As String

myfile = Selection.Paragraphs(1).Range.Text
Documents.Open "Drive\Folder\" & myfile

Where "Drive\Folder\" are the same as used in the code above.

To apply a particular font, use

With ActiveDocument.Tables(1).Cell(1, 1).Range.Font
   .Name = "Arial"
   .Size = 10
End With

Change the name of the font and the size to those that take your fancy.

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Ok,
>
[quoted text clipped - 45 lines]
>> updated
>> each time.
lorne17 - 28 Apr 2008 16:02 GMT
I am so sorry to keep bothering you on this matter.  I really appreciate
the help.

I tried replacing that code with: MyPath = "Drive:\Folder\"

But it doesn't work.  When I place my path in there, it runs the macro
with no errors and acts as if it's working, and flashes the highlighted
selection in my table.  But doesnt' insert any file names?  Any reason
why this is?

This is what I have:

> Sub Autonew()
>
[quoted text clipped - 23 lines]
>
> End Sub

With that said, what is wrong with it?  Anything you see?  

Also, regarding your suggestion for making this a template file.  We'll
never need to use this macro on another file.  I just wanted it to run
when I open the current document not a new document with this template
file.  Does that make sense?

Also what's the code to make the font bold?  I tried: .Style = Bold.
Didn't work :P

I assume, there is no way to make the file names in the list links to
each individual file?  

Thanks again!!  You really are a HUUUGE HELP :)

Lorne

Doug Robbins - Word MVP;2742110 Wrote:
> Like I said, I would recommend that you save this document as a
> template,
[quoted text clipped - 99 lines]
> updated
> each time.

Signature

lorne17

Doug Robbins - Word MVP - 29 Apr 2008 12:28 GMT
This line of code:

MyPath = "O:\Detail-Standards\Revit How To\Video Tutorials"

should be:

MyPath = "O:\Detail-Standards\Revit How To\Video Tutorials\"

That is, it must terminate in a path separator \
Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> I am so sorry to keep bothering you on this matter.  I really appreciate
> the help.
[quoted text clipped - 157 lines]
>> updated
>> each time.
lorne17 - 29 Apr 2008 18:04 GMT
Awesome thanks for the help. I figured out the bold too:

.Bold = True

I think we have it to our liking.  If anyone knows how to make i
automatic upon opening that would be best.  

Thanks for the patience and help.

Lorne

Doug Robbins - Word MVP;2745679 Wrote:
> This line of code:
>
[quoted text clipped - 122 lines]
> Change the name of the font and the size to those that take your
> fancy.

Signature

lorne17

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.