Group:  Microsoft Word ยป microsoft.public.word.vba.general
Thread: Creating a Large Document using Insert File Link

DotNetBag
.NET Development Newsgroups

HTVi
TV Discussion Newsgroups

Our Hot Pick: Rising Antivirus 2006 - Certified by TUV & Checkmark! Get 10% discount by entering this coupon code: ONDISCOUNT10
Rising Antivirus 2006

Creating a Large Document using Insert File Link
NYSA-HD 24.08.2006 15:56:02
I am creating a 2000 page book from several smaller files. I have a
directory where there is a file named for each date the file was created.
For example, 20060102, 20060105, etc.... Where the filenames are YYYYMMDD.
There may not be a file for every date, but all files are named by date. I
would like to avoid master documents because of corruption issues. My
thought was to create a document with my headers and page numbers for each
months worth of files. In each month document I need a macro that would go
out and look to the directory and insert each file in the month directory
into the new file in sequencial order as a linked file. The field codes I am
looking to drop are { INCLUDETEXT "U:\\Project\\20060102.dot"}, etc... so
that the macro would just read the files in the folder and insert the
includetext field for each file in the folder in order. When I look at the
final document for each month it would be all data for all dates, but I could
update the files individually and would automatically update the month
document.

Is anything like this possible? Is there a better way to do such a document
creation?
Re: Creating a Large Document using Insert File Link
"Jezebel" <warcrimes[ at ]whitehouse.gov> 24.08.2006 20:44:08
1. It would help if you explained why you need to combine the files in the
first place. What will you do with the compound document that you can't do
with the individual files?

2. 2000 pages isn't so massive anyway, unless the files contain a lot of
graphics or complex tables. You could just build an ordinary document.

3. Why are you working with .dot files?




"NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
news:4E56B824-23AF-4250-94F9-2EE5354FABF1[ at ]microsoft.com...
[Quoted Text]
>I am creating a 2000 page book from several smaller files. I have a
> directory where there is a file named for each date the file was created.
> For example, 20060102, 20060105, etc.... Where the filenames are YYYYMMDD.
> There may not be a file for every date, but all files are named by date.
> I
> would like to avoid master documents because of corruption issues. My
> thought was to create a document with my headers and page numbers for each
> months worth of files. In each month document I need a macro that would go
> out and look to the directory and insert each file in the month directory
> into the new file in sequencial order as a linked file. The field codes I
> am
> looking to drop are { INCLUDETEXT "U:\\Project\\20060102.dot"}, etc... so
> that the macro would just read the files in the folder and insert the
> includetext field for each file in the folder in order. When I look at
> the
> final document for each month it would be all data for all dates, but I
> could
> update the files individually and would automatically update the month
> document.
>
> Is anything like this possible? Is there a better way to do such a
> document
> creation?


Re: Creating a Large Document using Insert File Link
NYSA-HD 25.08.2006 14:50:02
Basically we have a group of inputters who record data that gets written in a
journal for each date a meeting takes place. We have automated their job by
creating .dot files for each form type for the journal entry and have text
files inserted by macros that feed the majority of the templates. When they
open Word we have a form where they enter the date and it grabs the text and
completes the form and asks them any variable questions. It auto saves the
file by date in a network folder. At the end of each year we need to combine
all of these individual files into one document w/ page numbers and common
headers and footers - also a TOC and Index with a title page. We don't see
an easy way to page number w/o combining somehow. The document does not have
graphics...mostly straight text w/ index markers and styles. There are
macros which run our application, but they don't need to be there when it is
combined.

What do you think is the best way to handle this?
Have I provided enough background info.



"Jezebel" wrote:

[Quoted Text]
> 1. It would help if you explained why you need to combine the files in the
> first place. What will you do with the compound document that you can't do
> with the individual files?
>
> 2. 2000 pages isn't so massive anyway, unless the files contain a lot of
> graphics or complex tables. You could just build an ordinary document.
>
> 3. Why are you working with .dot files?
>
>
>
>
> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
> news:4E56B824-23AF-4250-94F9-2EE5354FABF1[ at ]microsoft.com...
> >I am creating a 2000 page book from several smaller files. I have a
> > directory where there is a file named for each date the file was created.
> > For example, 20060102, 20060105, etc.... Where the filenames are YYYYMMDD.
> > There may not be a file for every date, but all files are named by date.
> > I
> > would like to avoid master documents because of corruption issues. My
> > thought was to create a document with my headers and page numbers for each
> > months worth of files. In each month document I need a macro that would go
> > out and look to the directory and insert each file in the month directory
> > into the new file in sequencial order as a linked file. The field codes I
> > am
> > looking to drop are { INCLUDETEXT "U:\\Project\\20060102.dot"}, etc... so
> > that the macro would just read the files in the folder and insert the
> > includetext field for each file in the folder in order. When I look at
> > the
> > final document for each month it would be all data for all dates, but I
> > could
> > update the files individually and would automatically update the month
> > document.
> >
> > Is anything like this possible? Is there a better way to do such a
> > document
> > creation?
>
>
>
Re: Creating a Large Document using Insert File Link
"Jezebel" <warcrimes[ at ]whitehouse.gov> 25.08.2006 21:58:04
1. Your inputters should be using the the .dot files as templates, so the
files you get back should be .doc files. If not, you haven't explained to
them well enough how to install the and use the templates.

2. From your description, simply combining all the docs into one big one
should be fine, particularly as it's just a yearly one-off and presumably
you don't need to do anything with the finished document except print it.





"NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
news:0805C936-E19D-4E1E-AF48-0B12ABF85719[ at ]microsoft.com...
[Quoted Text]
> Basically we have a group of inputters who record data that gets written
> in a
> journal for each date a meeting takes place. We have automated their job
> by
> creating .dot files for each form type for the journal entry and have text
> files inserted by macros that feed the majority of the templates. When
> they
> open Word we have a form where they enter the date and it grabs the text
> and
> completes the form and asks them any variable questions. It auto saves
> the
> file by date in a network folder. At the end of each year we need to
> combine
> all of these individual files into one document w/ page numbers and common
> headers and footers - also a TOC and Index with a title page. We don't
> see
> an easy way to page number w/o combining somehow. The document does not
> have
> graphics...mostly straight text w/ index markers and styles. There are
> macros which run our application, but they don't need to be there when it
> is
> combined.
>
> What do you think is the best way to handle this?
> Have I provided enough background info.
>
>
>
> "Jezebel" wrote:
>
>> 1. It would help if you explained why you need to combine the files in
>> the
>> first place. What will you do with the compound document that you can't
>> do
>> with the individual files?
>>
>> 2. 2000 pages isn't so massive anyway, unless the files contain a lot of
>> graphics or complex tables. You could just build an ordinary document.
>>
>> 3. Why are you working with .dot files?
>>
>>
>>
>>
>> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
>> news:4E56B824-23AF-4250-94F9-2EE5354FABF1[ at ]microsoft.com...
>> >I am creating a 2000 page book from several smaller files. I have a
>> > directory where there is a file named for each date the file was
>> > created.
>> > For example, 20060102, 20060105, etc.... Where the filenames are
>> > YYYYMMDD.
>> > There may not be a file for every date, but all files are named by
>> > date.
>> > I
>> > would like to avoid master documents because of corruption issues. My
>> > thought was to create a document with my headers and page numbers for
>> > each
>> > months worth of files. In each month document I need a macro that would
>> > go
>> > out and look to the directory and insert each file in the month
>> > directory
>> > into the new file in sequencial order as a linked file. The field
>> > codes I
>> > am
>> > looking to drop are { INCLUDETEXT "U:\\Project\\20060102.dot"}, etc...
>> > so
>> > that the macro would just read the files in the folder and insert the
>> > includetext field for each file in the folder in order. When I look at
>> > the
>> > final document for each month it would be all data for all dates, but I
>> > could
>> > update the files individually and would automatically update the month
>> > document.
>> >
>> > Is anything like this possible? Is there a better way to do such a
>> > document
>> > creation?
>>
>>
>>


Re: Creating a Large Document using Insert File Link
NYSA-HD 29.08.2006 15:08:01
I'm sorry, you were right the outputted files are .doc files named for the
date YYYYMMDD.doc

What is the easiest way to combine them all in date order w/o manually
inserting each file?



"Jezebel" wrote:

[Quoted Text]
> 1. Your inputters should be using the the .dot files as templates, so the
> files you get back should be .doc files. If not, you haven't explained to
> them well enough how to install the and use the templates.
>
> 2. From your description, simply combining all the docs into one big one
> should be fine, particularly as it's just a yearly one-off and presumably
> you don't need to do anything with the finished document except print it.
>
>
>
>
>
> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
> news:0805C936-E19D-4E1E-AF48-0B12ABF85719[ at ]microsoft.com...
> > Basically we have a group of inputters who record data that gets written
> > in a
> > journal for each date a meeting takes place. We have automated their job
> > by
> > creating .dot files for each form type for the journal entry and have text
> > files inserted by macros that feed the majority of the templates. When
> > they
> > open Word we have a form where they enter the date and it grabs the text
> > and
> > completes the form and asks them any variable questions. It auto saves
> > the
> > file by date in a network folder. At the end of each year we need to
> > combine
> > all of these individual files into one document w/ page numbers and common
> > headers and footers - also a TOC and Index with a title page. We don't
> > see
> > an easy way to page number w/o combining somehow. The document does not
> > have
> > graphics...mostly straight text w/ index markers and styles. There are
> > macros which run our application, but they don't need to be there when it
> > is
> > combined.
> >
> > What do you think is the best way to handle this?
> > Have I provided enough background info.
> >
> >
> >
> > "Jezebel" wrote:
> >
> >> 1. It would help if you explained why you need to combine the files in
> >> the
> >> first place. What will you do with the compound document that you can't
> >> do
> >> with the individual files?
> >>
> >> 2. 2000 pages isn't so massive anyway, unless the files contain a lot of
> >> graphics or complex tables. You could just build an ordinary document.
> >>
> >> 3. Why are you working with .dot files?
> >>
> >>
> >>
> >>
> >> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
> >> news:4E56B824-23AF-4250-94F9-2EE5354FABF1[ at ]microsoft.com...
> >> >I am creating a 2000 page book from several smaller files. I have a
> >> > directory where there is a file named for each date the file was
> >> > created.
> >> > For example, 20060102, 20060105, etc.... Where the filenames are
> >> > YYYYMMDD.
> >> > There may not be a file for every date, but all files are named by
> >> > date.
> >> > I
> >> > would like to avoid master documents because of corruption issues. My
> >> > thought was to create a document with my headers and page numbers for
> >> > each
> >> > months worth of files. In each month document I need a macro that would
> >> > go
> >> > out and look to the directory and insert each file in the month
> >> > directory
> >> > into the new file in sequencial order as a linked file. The field
> >> > codes I
> >> > am
> >> > looking to drop are { INCLUDETEXT "U:\\Project\\20060102.dot"}, etc...
> >> > so
> >> > that the macro would just read the files in the folder and insert the
> >> > includetext field for each file in the folder in order. When I look at
> >> > the
> >> > final document for each month it would be all data for all dates, but I
> >> > could
> >> > update the files individually and would automatically update the month
> >> > document.
> >> >
> >> > Is anything like this possible? Is there a better way to do such a
> >> > document
> >> > creation?
> >>
> >>
> >>
>
>
>
Re: Creating a Large Document using Insert File Link
"Doug Robbins - Word MVP" <dkr[ at ]REMOVECAPSmvps.org> 30.08.2006 10:12:12
If you put all of the documents in a folder by themselves, a macro
containing the following code should insert each of them into a new document
in the date order:

Dim MyPath As String

Dim MyName As String

Dim Source As Document, Target As Document

Dim SourceFile As Range

Dim i As Long

Dim FileList As Document

Set FileList = Documents.Add

'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

'get files from the selected path

'and insert them into the doc

MyName = Dir$(MyPath & "*.*")

Do While MyName <> ""

Selection.InsertAfter MyName & vbCr

MyName = Dir

Loop

'Sort the list of files

FileList.Range.Sort SortFieldType:=wdSortFieldAlphanumeric,
FieldNumber:="Paragraphs"

'Delete the empty paragraph that will be at the top of the list of files

FileList.Paragraphs(1).Range.Delete

'Start a new document into which each of the others will be inserted

Set Target = Documents.Add

'Iterate through the list of files, getting the name of each file, opening
it

'and inserting its contents into the Target document

For i = 1 To FileList.Paragraphs.Count

Set SourceFile = FileList.Paragraphs(i).Range

SourceFile.End = SourceFile.End - 1

Set Source = Documents.Open(MyPath & SourceFile.Text)

Target.Range.InsertAfter Source.Range.FormattedText

Source.Close wdDoNotSaveChanges

Next i



Also see the article "Print all documents in a given folder to a single
print file" at:

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




--
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

"NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
news:4EB857B5-B768-4A05-9472-107C8999795C[ at ]microsoft.com...
[Quoted Text]
> I'm sorry, you were right the outputted files are .doc files named for the
> date YYYYMMDD.doc
>
> What is the easiest way to combine them all in date order w/o manually
> inserting each file?
>
>
>
> "Jezebel" wrote:
>
>> 1. Your inputters should be using the the .dot files as templates, so the
>> files you get back should be .doc files. If not, you haven't explained to
>> them well enough how to install the and use the templates.
>>
>> 2. From your description, simply combining all the docs into one big one
>> should be fine, particularly as it's just a yearly one-off and presumably
>> you don't need to do anything with the finished document except print it.
>>
>>
>>
>>
>>
>> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
>> news:0805C936-E19D-4E1E-AF48-0B12ABF85719[ at ]microsoft.com...
>> > Basically we have a group of inputters who record data that gets
>> > written
>> > in a
>> > journal for each date a meeting takes place. We have automated their
>> > job
>> > by
>> > creating .dot files for each form type for the journal entry and have
>> > text
>> > files inserted by macros that feed the majority of the templates. When
>> > they
>> > open Word we have a form where they enter the date and it grabs the
>> > text
>> > and
>> > completes the form and asks them any variable questions. It auto saves
>> > the
>> > file by date in a network folder. At the end of each year we need to
>> > combine
>> > all of these individual files into one document w/ page numbers and
>> > common
>> > headers and footers - also a TOC and Index with a title page. We don't
>> > see
>> > an easy way to page number w/o combining somehow. The document does
>> > not
>> > have
>> > graphics...mostly straight text w/ index markers and styles. There are
>> > macros which run our application, but they don't need to be there when
>> > it
>> > is
>> > combined.
>> >
>> > What do you think is the best way to handle this?
>> > Have I provided enough background info.
>> >
>> >
>> >
>> > "Jezebel" wrote:
>> >
>> >> 1. It would help if you explained why you need to combine the files in
>> >> the
>> >> first place. What will you do with the compound document that you
>> >> can't
>> >> do
>> >> with the individual files?
>> >>
>> >> 2. 2000 pages isn't so massive anyway, unless the files contain a lot
>> >> of
>> >> graphics or complex tables. You could just build an ordinary document.
>> >>
>> >> 3. Why are you working with .dot files?
>> >>
>> >>
>> >>
>> >>
>> >> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
>> >> news:4E56B824-23AF-4250-94F9-2EE5354FABF1[ at ]microsoft.com...
>> >> >I am creating a 2000 page book from several smaller files. I have a
>> >> > directory where there is a file named for each date the file was
>> >> > created.
>> >> > For example, 20060102, 20060105, etc.... Where the filenames are
>> >> > YYYYMMDD.
>> >> > There may not be a file for every date, but all files are named by
>> >> > date.
>> >> > I
>> >> > would like to avoid master documents because of corruption issues.
>> >> > My
>> >> > thought was to create a document with my headers and page numbers
>> >> > for
>> >> > each
>> >> > months worth of files. In each month document I need a macro that
>> >> > would
>> >> > go
>> >> > out and look to the directory and insert each file in the month
>> >> > directory
>> >> > into the new file in sequencial order as a linked file. The field
>> >> > codes I
>> >> > am
>> >> > looking to drop are { INCLUDETEXT "U:\\Project\\20060102.dot"},
>> >> > etc...
>> >> > so
>> >> > that the macro would just read the files in the folder and insert
>> >> > the
>> >> > includetext field for each file in the folder in order. When I look
>> >> > at
>> >> > the
>> >> > final document for each month it would be all data for all dates,
>> >> > but I
>> >> > could
>> >> > update the files individually and would automatically update the
>> >> > month
>> >> > document.
>> >> >
>> >> > Is anything like this possible? Is there a better way to do such a
>> >> > document
>> >> > creation?
>> >>
>> >>
>> >>
>>
>>
>>


Re: Creating a Large Document using Insert File Link
NYSA-HD 30.08.2006 15:30:01
This is exactly what I wanted, but I have one issue. The doc files I am
inserting have inherited macros. How can the code below insert the files w/o
the macros or better yet as Links to the original documents? When I run the
code as is all my dialogue boxes from the macros pop up, and I will no longer
need them at this point.

I really appreciate the help with this.



"Doug Robbins - Word MVP" wrote:

[Quoted Text]
> If you put all of the documents in a folder by themselves, a macro
> containing the following code should insert each of them into a new document
> in the date order:
>
> Dim MyPath As String
>
> Dim MyName As String
>
> Dim Source As Document, Target As Document
>
> Dim SourceFile As Range
>
> Dim i As Long
>
> Dim FileList As Document
>
> Set FileList = Documents.Add
>
> '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
>
> 'get files from the selected path
>
> 'and insert them into the doc
>
> MyName = Dir$(MyPath & "*.*")
>
> Do While MyName <> ""
>
> Selection.InsertAfter MyName & vbCr
>
> MyName = Dir
>
> Loop
>
> 'Sort the list of files
>
> FileList.Range.Sort SortFieldType:=wdSortFieldAlphanumeric,
> FieldNumber:="Paragraphs"
>
> 'Delete the empty paragraph that will be at the top of the list of files
>
> FileList.Paragraphs(1).Range.Delete
>
> 'Start a new document into which each of the others will be inserted
>
> Set Target = Documents.Add
>
> 'Iterate through the list of files, getting the name of each file, opening
> it
>
> 'and inserting its contents into the Target document
>
> For i = 1 To FileList.Paragraphs.Count
>
> Set SourceFile = FileList.Paragraphs(i).Range
>
> SourceFile.End = SourceFile.End - 1
>
> Set Source = Documents.Open(MyPath & SourceFile.Text)
>
> Target.Range.InsertAfter Source.Range.FormattedText
>
> Source.Close wdDoNotSaveChanges
>
> Next i
>
>
>
> Also see the article "Print all documents in a given folder to a single
> print file" at:
>
> http://www.word.mvps.org/FAQs/MacrosVBA/PrintAllDocsInFldr.htm
>
>
>
>
> --
> 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
>
> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
> news:4EB857B5-B768-4A05-9472-107C8999795C[ at ]microsoft.com...
> > I'm sorry, you were right the outputted files are .doc files named for the
> > date YYYYMMDD.doc
> >
> > What is the easiest way to combine them all in date order w/o manually
> > inserting each file?
> >
> >
> >
> > "Jezebel" wrote:
> >
> >> 1. Your inputters should be using the the .dot files as templates, so the
> >> files you get back should be .doc files. If not, you haven't explained to
> >> them well enough how to install the and use the templates.
> >>
> >> 2. From your description, simply combining all the docs into one big one
> >> should be fine, particularly as it's just a yearly one-off and presumably
> >> you don't need to do anything with the finished document except print it.
> >>
> >>
> >>
> >>
> >>
> >> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
> >> news:0805C936-E19D-4E1E-AF48-0B12ABF85719[ at ]microsoft.com...
> >> > Basically we have a group of inputters who record data that gets
> >> > written
> >> > in a
> >> > journal for each date a meeting takes place. We have automated their
> >> > job
> >> > by
> >> > creating .dot files for each form type for the journal entry and have
> >> > text
> >> > files inserted by macros that feed the majority of the templates. When
> >> > they
> >> > open Word we have a form where they enter the date and it grabs the
> >> > text
> >> > and
> >> > completes the form and asks them any variable questions. It auto saves
> >> > the
> >> > file by date in a network folder. At the end of each year we need to
> >> > combine
> >> > all of these individual files into one document w/ page numbers and
> >> > common
> >> > headers and footers - also a TOC and Index with a title page. We don't
> >> > see
> >> > an easy way to page number w/o combining somehow. The document does
> >> > not
> >> > have
> >> > graphics...mostly straight text w/ index markers and styles. There are
> >> > macros which run our application, but they don't need to be there when
> >> > it
> >> > is
> >> > combined.
> >> >
> >> > What do you think is the best way to handle this?
> >> > Have I provided enough background info.
> >> >
> >> >
> >> >
> >> > "Jezebel" wrote:
> >> >
> >> >> 1. It would help if you explained why you need to combine the files in
> >> >> the
> >> >> first place. What will you do with the compound document that you
> >> >> can't
> >> >> do
> >> >> with the individual files?
> >> >>
> >> >> 2. 2000 pages isn't so massive anyway, unless the files contain a lot
> >> >> of
> >> >> graphics or complex tables. You could just build an ordinary document.
> >> >>
> >> >> 3. Why are you working with .dot files?
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
> >> >> news:4E56B824-23AF-4250-94F9-2EE5354FABF1[ at ]microsoft.com...
> >> >> >I am creating a 2000 page book from several smaller files. I have a
> >> >> > directory where there is a file named for each date the file was
> >> >> > created.
> >> >> > For example, 20060102, 20060105, etc.... Where the filenames are
> >> >> > YYYYMMDD.
> >> >> > There may not be a file for every date, but all files are named by
> >> >> > date.
> >> >> > I
> >> >> > would like to avoid master documents because of corruption issues.
> >> >> > My
> >> >> > thought was to create a document with my headers and page numbers
> >> >> > for
> >> >> > each
> >> >> > months worth of files. In each month document I need a macro that
> >> >> > would
> >> >> > go
> >> >> > out and look to the directory and insert each file in the month
> >> >> > directory
> >> >> > into the new file in sequencial order as a linked file. The field
> >> >> > codes I
> >> >> > am
> >> >> > looking to drop are { INCLUDETEXT "U:\\Project\\20060102.dot"},
> >> >> > etc...
> >> >> > so
> >> >> > that the macro would just read the files in the folder and insert
> >> >> > the
> >> >> > includetext field for each file in the folder in order. When I look
> >> >> > at
> >> >> > the
> >> >> > final document for each month it would be all data for all dates,
> >> >> > but I
> >> >> > could
> >> >> > update the files individually and would automatically update the
> >> >> > month
> >> >> > document.
> >> >> >
> >> >> > Is anything like this possible? Is there a better way to do such a
> >> >> > document
> >> >> > creation?
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>
Re: Creating a Large Document using Insert File Link
"Doug Robbins - Word MVP" <dkr[ at ]REMOVECAPSmvps.org> 30.08.2006 20:07:45
Set the macro security level to High (Tools>Macro>Security), temporarily if
necessary, then the macros in the documents will be ignored.

--
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

"NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
news:4E7D679C-8120-4E0F-9F2F-F1A9B37FA1B3[ at ]microsoft.com...
[Quoted Text]
> This is exactly what I wanted, but I have one issue. The doc files I am
> inserting have inherited macros. How can the code below insert the files
> w/o
> the macros or better yet as Links to the original documents? When I run
> the
> code as is all my dialogue boxes from the macros pop up, and I will no
> longer
> need them at this point.
>
> I really appreciate the help with this.
>
>
>
> "Doug Robbins - Word MVP" wrote:
>
>> If you put all of the documents in a folder by themselves, a macro
>> containing the following code should insert each of them into a new
>> document
>> in the date order:
>>
>> Dim MyPath As String
>>
>> Dim MyName As String
>>
>> Dim Source As Document, Target As Document
>>
>> Dim SourceFile As Range
>>
>> Dim i As Long
>>
>> Dim FileList As Document
>>
>> Set FileList = Documents.Add
>>
>> '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
>>
>> 'get files from the selected path
>>
>> 'and insert them into the doc
>>
>> MyName = Dir$(MyPath & "*.*")
>>
>> Do While MyName <> ""
>>
>> Selection.InsertAfter MyName & vbCr
>>
>> MyName = Dir
>>
>> Loop
>>
>> 'Sort the list of files
>>
>> FileList.Range.Sort SortFieldType:=wdSortFieldAlphanumeric,
>> FieldNumber:="Paragraphs"
>>
>> 'Delete the empty paragraph that will be at the top of the list of files
>>
>> FileList.Paragraphs(1).Range.Delete
>>
>> 'Start a new document into which each of the others will be inserted
>>
>> Set Target = Documents.Add
>>
>> 'Iterate through the list of files, getting the name of each file,
>> opening
>> it
>>
>> 'and inserting its contents into the Target document
>>
>> For i = 1 To FileList.Paragraphs.Count
>>
>> Set SourceFile = FileList.Paragraphs(i).Range
>>
>> SourceFile.End = SourceFile.End - 1
>>
>> Set Source = Documents.Open(MyPath & SourceFile.Text)
>>
>> Target.Range.InsertAfter Source.Range.FormattedText
>>
>> Source.Close wdDoNotSaveChanges
>>
>> Next i
>>
>>
>>
>> Also see the article "Print all documents in a given folder to a single
>> print file" at:
>>
>> http://www.word.mvps.org/FAQs/MacrosVBA/PrintAllDocsInFldr.htm
>>
>>
>>
>>
>> --
>> 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
>>
>> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
>> news:4EB857B5-B768-4A05-9472-107C8999795C[ at ]microsoft.com...
>> > I'm sorry, you were right the outputted files are .doc files named for
>> > the
>> > date YYYYMMDD.doc
>> >
>> > What is the easiest way to combine them all in date order w/o manually
>> > inserting each file?
>> >
>> >
>> >
>> > "Jezebel" wrote:
>> >
>> >> 1. Your inputters should be using the the .dot files as templates, so
>> >> the
>> >> files you get back should be .doc files. If not, you haven't explained
>> >> to
>> >> them well enough how to install the and use the templates.
>> >>
>> >> 2. From your description, simply combining all the docs into one big
>> >> one
>> >> should be fine, particularly as it's just a yearly one-off and
>> >> presumably
>> >> you don't need to do anything with the finished document except print
>> >> it.
>> >>
>> >>
>> >>
>> >>
>> >>
>> >> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
>> >> news:0805C936-E19D-4E1E-AF48-0B12ABF85719[ at ]microsoft.com...
>> >> > Basically we have a group of inputters who record data that gets
>> >> > written
>> >> > in a
>> >> > journal for each date a meeting takes place. We have automated
>> >> > their
>> >> > job
>> >> > by
>> >> > creating .dot files for each form type for the journal entry and
>> >> > have
>> >> > text
>> >> > files inserted by macros that feed the majority of the templates.
>> >> > When
>> >> > they
>> >> > open Word we have a form where they enter the date and it grabs the
>> >> > text
>> >> > and
>> >> > completes the form and asks them any variable questions. It auto
>> >> > saves
>> >> > the
>> >> > file by date in a network folder. At the end of each year we need
>> >> > to
>> >> > combine
>> >> > all of these individual files into one document w/ page numbers and
>> >> > common
>> >> > headers and footers - also a TOC and Index with a title page. We
>> >> > don't
>> >> > see
>> >> > an easy way to page number w/o combining somehow. The document does
>> >> > not
>> >> > have
>> >> > graphics...mostly straight text w/ index markers and styles. There
>> >> > are
>> >> > macros which run our application, but they don't need to be there
>> >> > when
>> >> > it
>> >> > is
>> >> > combined.
>> >> >
>> >> > What do you think is the best way to handle this?
>> >> > Have I provided enough background info.
>> >> >
>> >> >
>> >> >
>> >> > "Jezebel" wrote:
>> >> >
>> >> >> 1. It would help if you explained why you need to combine the files
>> >> >> in
>> >> >> the
>> >> >> first place. What will you do with the compound document that you
>> >> >> can't
>> >> >> do
>> >> >> with the individual files?
>> >> >>
>> >> >> 2. 2000 pages isn't so massive anyway, unless the files contain a
>> >> >> lot
>> >> >> of
>> >> >> graphics or complex tables. You could just build an ordinary
>> >> >> document.
>> >> >>
>> >> >> 3. Why are you working with .dot files?
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
>> >> >> news:4E56B824-23AF-4250-94F9-2EE5354FABF1[ at ]microsoft.com...
>> >> >> >I am creating a 2000 page book from several smaller files. I have
>> >> >> >a
>> >> >> > directory where there is a file named for each date the file was
>> >> >> > created.
>> >> >> > For example, 20060102, 20060105, etc.... Where the filenames are
>> >> >> > YYYYMMDD.
>> >> >> > There may not be a file for every date, but all files are named
>> >> >> > by
>> >> >> > date.
>> >> >> > I
>> >> >> > would like to avoid master documents because of corruption
>> >> >> > issues.
>> >> >> > My
>> >> >> > thought was to create a document with my headers and page numbers
>> >> >> > for
>> >> >> > each
>> >> >> > months worth of files. In each month document I need a macro that
>> >> >> > would
>> >> >> > go
>> >> >> > out and look to the directory and insert each file in the month
>> >> >> > directory
>> >> >> > into the new file in sequencial order as a linked file. The
>> >> >> > field
>> >> >> > codes I
>> >> >> > am
>> >> >> > looking to drop are { INCLUDETEXT "U:\\Project\\20060102.dot"},
>> >> >> > etc...
>> >> >> > so
>> >> >> > that the macro would just read the files in the folder and insert
>> >> >> > the
>> >> >> > includetext field for each file in the folder in order. When I
>> >> >> > look
>> >> >> > at
>> >> >> > the
>> >> >> > final document for each month it would be all data for all dates,
>> >> >> > but I
>> >> >> > could
>> >> >> > update the files individually and would automatically update the
>> >> >> > month
>> >> >> > document.
>> >> >> >
>> >> >> > Is anything like this possible? Is there a better way to do such
>> >> >> > a
>> >> >> > document
>> >> >> > creation?
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>>


Re: Creating a Large Document using Insert File Link
NYSA-HD 31.08.2006 16:37:02
This solution doesn't work b/c they are all trusted macros. Any other ideas
to change the macro to insert files as linked objects?



"Doug Robbins - Word MVP" wrote:

[Quoted Text]
> Set the macro security level to High (Tools>Macro>Security), temporarily if
> necessary, then the macros in the documents will be ignored.
>
> --
> 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
>
> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
> news:4E7D679C-8120-4E0F-9F2F-F1A9B37FA1B3[ at ]microsoft.com...
> > This is exactly what I wanted, but I have one issue. The doc files I am
> > inserting have inherited macros. How can the code below insert the files
> > w/o
> > the macros or better yet as Links to the original documents? When I run
> > the
> > code as is all my dialogue boxes from the macros pop up, and I will no
> > longer
> > need them at this point.
> >
> > I really appreciate the help with this.
> >
> >
> >
> > "Doug Robbins - Word MVP" wrote:
> >
> >> If you put all of the documents in a folder by themselves, a macro
> >> containing the following code should insert each of them into a new
> >> document
> >> in the date order:
> >>
> >> Dim MyPath As String
> >>
> >> Dim MyName As String
> >>
> >> Dim Source As Document, Target As Document
> >>
> >> Dim SourceFile As Range
> >>
> >> Dim i As Long
> >>
> >> Dim FileList As Document
> >>
> >> Set FileList = Documents.Add
> >>
> >> '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
> >>
> >> 'get files from the selected path
> >>
> >> 'and insert them into the doc
> >>
> >> MyName = Dir$(MyPath & "*.*")
> >>
> >> Do While MyName <> ""
> >>
> >> Selection.InsertAfter MyName & vbCr
> >>
> >> MyName = Dir
> >>
> >> Loop
> >>
> >> 'Sort the list of files
> >>
> >> FileList.Range.Sort SortFieldType:=wdSortFieldAlphanumeric,
> >> FieldNumber:="Paragraphs"
> >>
> >> 'Delete the empty paragraph that will be at the top of the list of files
> >>
> >> FileList.Paragraphs(1).Range.Delete
> >>
> >> 'Start a new document into which each of the others will be inserted
> >>
> >> Set Target = Documents.Add
> >>
> >> 'Iterate through the list of files, getting the name of each file,
> >> opening
> >> it
> >>
> >> 'and inserting its contents into the Target document
> >>
> >> For i = 1 To FileList.Paragraphs.Count
> >>
> >> Set SourceFile = FileList.Paragraphs(i).Range
> >>
> >> SourceFile.End = SourceFile.End - 1
> >>
> >> Set Source = Documents.Open(MyPath & SourceFile.Text)
> >>
> >> Target.Range.InsertAfter Source.Range.FormattedText
> >>
> >> Source.Close wdDoNotSaveChanges
> >>
> >> Next i
> >>
> >>
> >>
> >> Also see the article "Print all documents in a given folder to a single
> >> print file" at:
> >>
> >> http://www.word.mvps.org/FAQs/MacrosVBA/PrintAllDocsInFldr.htm
> >>
> >>
> >>
> >>
> >> --
> >> 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
> >>
> >> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
> >> news:4EB857B5-B768-4A05-9472-107C8999795C[ at ]microsoft.com...
> >> > I'm sorry, you were right the outputted files are .doc files named for
> >> > the
> >> > date YYYYMMDD.doc
> >> >
> >> > What is the easiest way to combine them all in date order w/o manually
> >> > inserting each file?
> >> >
> >> >
> >> >
> >> > "Jezebel" wrote:
> >> >
> >> >> 1. Your inputters should be using the the .dot files as templates, so
> >> >> the
> >> >> files you get back should be .doc files. If not, you haven't explained
> >> >> to
> >> >> them well enough how to install the and use the templates.
> >> >>
> >> >> 2. From your description, simply combining all the docs into one big
> >> >> one
> >> >> should be fine, particularly as it's just a yearly one-off and
> >> >> presumably
> >> >> you don't need to do anything with the finished document except print
> >> >> it.
> >> >>
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
> >> >> news:0805C936-E19D-4E1E-AF48-0B12ABF85719[ at ]microsoft.com...
> >> >> > Basically we have a group of inputters who record data that gets
> >> >> > written
> >> >> > in a
> >> >> > journal for each date a meeting takes place. We have automated
> >> >> > their
> >> >> > job
> >> >> > by
> >> >> > creating .dot files for each form type for the journal entry and
> >> >> > have
> >> >> > text
> >> >> > files inserted by macros that feed the majority of the templates.
> >> >> > When
> >> >> > they
> >> >> > open Word we have a form where they enter the date and it grabs the
> >> >> > text
> >> >> > and
> >> >> > completes the form and asks them any variable questions. It auto
> >> >> > saves
> >> >> > the
> >> >> > file by date in a network folder. At the end of each year we need
> >> >> > to
> >> >> > combine
> >> >> > all of these individual files into one document w/ page numbers and
> >> >> > common
> >> >> > headers and footers - also a TOC and Index with a title page. We
> >> >> > don't
> >> >> > see
> >> >> > an easy way to page number w/o combining somehow. The document does
> >> >> > not
> >> >> > have
> >> >> > graphics...mostly straight text w/ index markers and styles. There
> >> >> > are
> >> >> > macros which run our application, but they don't need to be there
> >> >> > when
> >> >> > it
> >> >> > is
> >> >> > combined.
> >> >> >
> >> >> > What do you think is the best way to handle this?
> >> >> > Have I provided enough background info.
> >> >> >
> >> >> >
> >> >> >
> >> >> > "Jezebel" wrote:
> >> >> >
> >> >> >> 1. It would help if you explained why you need to combine the files
> >> >> >> in
> >> >> >> the
> >> >> >> first place. What will you do with the compound document that you
> >> >> >> can't
> >> >> >> do
> >> >> >> with the individual files?
> >> >> >>
> >> >> >> 2. 2000 pages isn't so massive anyway, unless the files contain a
> >> >> >> lot
> >> >> >> of
> >> >> >> graphics or complex tables. You could just build an ordinary
> >> >> >> document.
> >> >> >>
> >> >> >> 3. Why are you working with .dot files?
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
> >> >> >> news:4E56B824-23AF-4250-94F9-2EE5354FABF1[ at ]microsoft.com...
> >> >> >> >I am creating a 2000 page book from several smaller files. I have
> >> >> >> >a
> >> >> >> > directory where there is a file named for each date the file was
> >> >> >> > created.
> >> >> >> > For example, 20060102, 20060105, etc.... Where the filenames are
> >> >> >> > YYYYMMDD.
> >> >> >> > There may not be a file for every date, but all files are named
> >> >> >> > by
> >> >> >> > date.
> >> >> >> > I
> >> >> >> > would like to avoid master documents because of corruption
> >> >> >> > issues.
> >> >> >> > My
> >> >> >> > thought was to create a document with my headers and page numbers
> >> >> >> > for
> >> >> >> > each
> >> >> >> > months worth of files. In each month document I need a macro that
> >> >> >> > would
> >> >> >> > go
> >> >> >> > out and look to the directory and insert each file in the month
> >> >> >> > directory
> >> >> >> > into the new file in sequencial order as a linked file. The
> >> >> >> > field
> >> >> >> > codes I
> >> >> >> > am
> >> >> >> > looking to drop are { INCLUDETEXT "U:\\Project\\20060102.dot"},
> >> >> >> > etc...
> >> >> >> > so
> >> >> >> > that the macro would just read the files in the folder and insert
> >> >> >> > the
> >> >> >> > includetext field for each file in the folder in order. When I
> >> >> >> > look
> >> >> >> > at
> >> >> >> > the
> >> >> >> > final document for each month it would be all data for all dates,
> >> >> >> > but I
> >> >> >> > could
> >> >> >> > update the files individually and would automatically update the
> >> >> >> > month
> >> >> >> > document.
> >> >> >> >
> >> >> >> > Is anything like this possible? Is there a better way to do such
> >> >> >> > a
> >> >> >> > document
> >> >> >> > creation?
> >> >> >>
> >> >> >>
> >> >> >>
> >> >>
> >> >>
> >> >>
> >>
> >>
> >>
>
>
>
Re: Creating a Large Document using Insert File Link
"Doug Robbins - Word MVP" <dkr[ at ]REMOVECAPSmvps.org> 01.09.2006 03:52:26
OK, I thought it was the macro security warning to which you were referring,
but on re-reading you post see what it is.

See the article "How can I prevent Word from running macros automatically
when I create a new instance of Word, open a Word document or create a new
one?" at:

http://www.word.mvps.org/FAQs/InterDev/DisableAutoMacros.htm


--
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

"NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
news:1B5AC737-46F0-4760-8DC4-51CC601674DB[ at ]microsoft.com...
[Quoted Text]
> This solution doesn't work b/c they are all trusted macros. Any other
> ideas
> to change the macro to insert files as linked objects?
>
>
>
> "Doug Robbins - Word MVP" wrote:
>
>> Set the macro security level to High (Tools>Macro>Security), temporarily
>> if
>> necessary, then the macros in the documents will be ignored.
>>
>> --
>> 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
>>
>> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
>> news:4E7D679C-8120-4E0F-9F2F-F1A9B37FA1B3[ at ]microsoft.com...
>> > This is exactly what I wanted, but I have one issue. The doc files I
>> > am
>> > inserting have inherited macros. How can the code below insert the
>> > files
>> > w/o
>> > the macros or better yet as Links to the original documents? When I
>> > run
>> > the
>> > code as is all my dialogue boxes from the macros pop up, and I will no
>> > longer
>> > need them at this point.
>> >
>> > I really appreciate the help with this.
>> >
>> >
>> >
>> > "Doug Robbins - Word MVP" wrote:
>> >
>> >> If you put all of the documents in a folder by themselves, a macro
>> >> containing the following code should insert each of them into a new
>> >> document
>> >> in the date order:
>> >>
>> >> Dim MyPath As String
>> >>
>> >> Dim MyName As String
>> >>
>> >> Dim Source As Document, Target As Document
>> >>
>> >> Dim SourceFile As Range
>> >>
>> >> Dim i As Long
>> >>
>> >> Dim FileList As Document
>> >>
>> >> Set FileList = Documents.Add
>> >>
>> >> '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
>> >>
>> >> 'get files from the selected path
>> >>
>> >> 'and insert them into the doc
>> >>
>> >> MyName = Dir$(MyPath & "*.*")
>> >>
>> >> Do While MyName <> ""
>> >>
>> >> Selection.InsertAfter MyName & vbCr
>> >>
>> >> MyName = Dir
>> >>
>> >> Loop
>> >>
>> >> 'Sort the list of files
>> >>
>> >> FileList.Range.Sort SortFieldType:=wdSortFieldAlphanumeric,
>> >> FieldNumber:="Paragraphs"
>> >>
>> >> 'Delete the empty paragraph that will be at the top of the list of
>> >> files
>> >>
>> >> FileList.Paragraphs(1).Range.Delete
>> >>
>> >> 'Start a new document into which each of the others will be inserted
>> >>
>> >> Set Target = Documents.Add
>> >>
>> >> 'Iterate through the list of files, getting the name of each file,
>> >> opening
>> >> it
>> >>
>> >> 'and inserting its contents into the Target document
>> >>
>> >> For i = 1 To FileList.Paragraphs.Count
>> >>
>> >> Set SourceFile = FileList.Paragraphs(i).Range
>> >>
>> >> SourceFile.End = SourceFile.End - 1
>> >>
>> >> Set Source = Documents.Open(MyPath & SourceFile.Text)
>> >>
>> >> Target.Range.InsertAfter Source.Range.FormattedText
>> >>
>> >> Source.Close wdDoNotSaveChanges
>> >>
>> >> Next i
>> >>
>> >>
>> >>
>> >> Also see the article "Print all documents in a given folder to a
>> >> single
>> >> print file" at:
>> >>
>> >> http://www.word.mvps.org/FAQs/MacrosVBA/PrintAllDocsInFldr.htm
>> >>
>> >>
>> >>
>> >>
>> >> --
>> >> 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
>> >>
>> >> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
>> >> news:4EB857B5-B768-4A05-9472-107C8999795C[ at ]microsoft.com...
>> >> > I'm sorry, you were right the outputted files are .doc files named
>> >> > for
>> >> > the
>> >> > date YYYYMMDD.doc
>> >> >
>> >> > What is the easiest way to combine them all in date order w/o
>> >> > manually
>> >> > inserting each file?
>> >> >
>> >> >
>> >> >
>> >> > "Jezebel" wrote:
>> >> >
>> >> >> 1. Your inputters should be using the the .dot files as templates,
>> >> >> so
>> >> >> the
>> >> >> files you get back should be .doc files. If not, you haven't
>> >> >> explained
>> >> >> to
>> >> >> them well enough how to install the and use the templates.
>> >> >>
>> >> >> 2. From your description, simply combining all the docs into one
>> >> >> big
>> >> >> one
>> >> >> should be fine, particularly as it's just a yearly one-off and
>> >> >> presumably
>> >> >> you don't need to do anything with the finished document except
>> >> >> print
>> >> >> it.
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
>> >> >> news:0805C936-E19D-4E1E-AF48-0B12ABF85719[ at ]microsoft.com...
>> >> >> > Basically we have a group of inputters who record data that gets
>> >> >> > written
>> >> >> > in a
>> >> >> > journal for each date a meeting takes place. We have automated
>> >> >> > their
>> >> >> > job
>> >> >> > by
>> >> >> > creating .dot files for each form type for the journal entry and
>> >> >> > have
>> >> >> > text
>> >> >> > files inserted by macros that feed the majority of the templates.
>> >> >> > When
>> >> >> > they
>> >> >> > open Word we have a form where they enter the date and it grabs
>> >> >> > the
>> >> >> > text
>> >> >> > and
>> >> >> > completes the form and asks them any variable questions. It auto
>> >> >> > saves
>> >> >> > the
>> >> >> > file by date in a network folder. At the end of each year we
>> >> >> > need
>> >> >> > to
>> >> >> > combine
>> >> >> > all of these individual files into one document w/ page numbers
>> >> >> > and
>> >> >> > common
>> >> >> > headers and footers - also a TOC and Index with a title page. We
>> >> >> > don't
>> >> >> > see
>> >> >> > an easy way to page number w/o combining somehow. The document
>> >> >> > does
>> >> >> > not
>> >> >> > have
>> >> >> > graphics...mostly straight text w/ index markers and styles.
>> >> >> > There
>> >> >> > are
>> >> >> > macros which run our application, but they don't need to be there
>> >> >> > when
>> >> >> > it
>> >> >> > is
>> >> >> > combined.
>> >> >> >
>> >> >> > What do you think is the best way to handle this?
>> >> >> > Have I provided enough background info.
>> >> >> >
>> >> >> >
>> >> >> >
>> >> >> > "Jezebel" wrote:
>> >> >> >
>> >> >> >> 1. It would help if you explained why you need to combine the
>> >> >> >> files
>> >> >> >> in
>> >> >> >> the
>> >> >> >> first place. What will you do with the compound document that
>> >> >> >> you
>> >> >> >> can't
>> >> >> >> do
>> >> >> >> with the individual files?
>> >> >> >>
>> >> >> >> 2. 2000 pages isn't so massive anyway, unless the files contain
>> >> >> >> a
>> >> >> >> lot
>> >> >> >> of
>> >> >> >> graphics or complex tables. You could just build an ordinary
>> >> >> >> document.
>> >> >> >>
>> >> >> >> 3. Why are you working with .dot files?
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >> >> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
>> >> >> >> news:4E56B824-23AF-4250-94F9-2EE5354FABF1[ at ]microsoft.com...
>> >> >> >> >I am creating a 2000 page book from several smaller files. I
>> >> >> >> >have
>> >> >> >> >a
>> >> >> >> > directory where there is a file named for each date the file
>> >> >> >> > was
>> >> >> >> > created.
>> >> >> >> > For example, 20060102, 20060105, etc.... Where the filenames
>> >> >> >> > are
>> >> >> >> > YYYYMMDD.
>> >> >> >> > There may not be a file for every date, but all files are
>> >> >> >> > named
>> >> >> >> > by
>> >> >> >> > date.
>> >> >> >> > I
>> >> >> >> > would like to avoid master documents because of corruption
>> >> >> >> > issues.
>> >> >> >> > My
>> >> >> >> > thought was to create a document with my headers and page
>> >> >> >> > numbers
>> >> >> >> > for
>> >> >> >> > each
>> >> >> >> > months worth of files. In each month document I need a macro
>> >> >> >> > that
>> >> >> >> > would
>> >> >> >> > go
>> >> >> >> > out and look to the directory and insert each file in the
>> >> >> >> > month
>> >> >> >> > directory
>> >> >> >> > into the new file in sequencial order as a linked file. The
>> >> >> >> > field
>> >> >> >> > codes I
>> >> >> >> > am
>> >> >> >> > looking to drop are { INCLUDETEXT
>> >> >> >> > "U:\\Project\\20060102.dot"},
>> >> >> >> > etc...
>> >> >> >> > so
>> >> >> >> > that the macro would just read the files in the folder and
>> >> >> >> > insert
>> >> >> >> > the
>> >> >> >> > includetext field for each file in the folder in order. When
>> >> >> >> > I
>> >> >> >> > look
>> >> >> >> > at
>> >> >> >> > the
>> >> >> >> > final document for each month it would be all data for all
>> >> >> >> > dates,
>> >> >> >> > but I
>> >> >> >> > could
>> >> >> >> > update the files individually and would automatically update
>> >> >> >> > the
>> >> >> >> > month
>> >> >> >> > document.
>> >> >> >> >
>> >> >> >> > Is anything like this possible? Is there a better way to do
>> >> >> >> > such
>> >> >> >> > a
>> >> >> >> > document
>> >> >> >> > creation?
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >>
>> >>
>> >>
>>
>>
>>


Re: Creating a Large Document using Insert File Link
Russ <drsN0SPAMmikle[ at ]hotmailD0Tcom.INVALID> 01.09.2006 03:59:56
NYSA-HD,

Using...
WordBasic.DisableAutoMacros 0
WordBasic.DisableAutoMacros 1
You might be able disable and enable auto macros respectively and still use
Doug's macro without dialogs popping up as each file is opened.
See link below for source of this information.

http://tinyurl.com/fe5ds

[Quoted Text]
> This solution doesn't work b/c they are all trusted macros. Any other ideas
> to change the macro to insert files as linked objects?
>
>
>
> "Doug Robbins - Word MVP" wrote:
>
>> Set the macro security level to High (Tools>Macro>Security), temporarily if
>> necessary, then the macros in the documents will be ignored.
>>
>> --
>> 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
>>
>> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
>> news:4E7D679C-8120-4E0F-9F2F-F1A9B37FA1B3[ at ]microsoft.com...
>>> This is exactly what I wanted, but I have one issue. The doc files I am
>>> inserting have inherited macros. How can the code below insert the files
>>> w/o
>>> the macros or better yet as Links to the original documents? When I run
>>> the
>>> code as is all my dialogue boxes from the macros pop up, and I will no
>>> longer
>>> need them at this point.
>>>
>>> I really appreciate the help with this.
>>>
>>>
>>>
>>> "Doug Robbins - Word MVP" wrote:
>>>
>>>> If you put all of the documents in a folder by themselves, a macro
>>>> containing the following code should insert each of them into a new
>>>> document
>>>> in the date order:
>>>>
>>>> Dim MyPath As String
>>>>
>>>> Dim MyName As String
>>>>
>>>> Dim Source As Document, Target As Document
>>>>
>>>> Dim SourceFile As Range
>>>>
>>>> Dim i As Long
>>>>
>>>> Dim FileList As Document
>>>>
>>>> Set FileList = Documents.Add
>>>>
>>>> '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
>>>>
>>>> 'get files from the selected path
>>>>
>>>> 'and insert them into the doc
>>>>
>>>> MyName = Dir$(MyPath & "*.*")
>>>>
>>>> Do While MyName <> ""
>>>>
>>>> Selection.InsertAfter MyName & vbCr
>>>>
>>>> MyName = Dir
>>>>
>>>> Loop
>>>>
>>>> 'Sort the list of files
>>>>
>>>> FileList.Range.Sort SortFieldType:=wdSortFieldAlphanumeric,
>>>> FieldNumber:="Paragraphs"
>>>>
>>>> 'Delete the empty paragraph that will be at the top of the list of files
>>>>
>>>> FileList.Paragraphs(1).Range.Delete
>>>>
>>>> 'Start a new document into which each of the others will be inserted
>>>>
>>>> Set Target = Documents.Add
>>>>
>>>> 'Iterate through the list of files, getting the name of each file,
>>>> opening
>>>> it
>>>>
>>>> 'and inserting its contents into the Target document
>>>>
>>>> For i = 1 To FileList.Paragraphs.Count
>>>>
>>>> Set SourceFile = FileList.Paragraphs(i).Range
>>>>
>>>> SourceFile.End = SourceFile.End - 1
>>>>
>>>> Set Source = Documents.Open(MyPath & SourceFile.Text)
>>>>
>>>> Target.Range.InsertAfter Source.Range.FormattedText
>>>>
>>>> Source.Close wdDoNotSaveChanges
>>>>
>>>> Next i
>>>>
>>>>
>>>>
>>>> Also see the article "Print all documents in a given folder to a single
>>>> print file" at:
>>>>
>>>> http://www.word.mvps.org/FAQs/MacrosVBA/PrintAllDocsInFldr.htm
>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> 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
>>>>
>>>> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
>>>> news:4EB857B5-B768-4A05-9472-107C8999795C[ at ]microsoft.com...
>>>>> I'm sorry, you were right the outputted files are .doc files named for
>>>>> the
>>>>> date YYYYMMDD.doc
>>>>>
>>>>> What is the easiest way to combine them all in date order w/o manually
>>>>> inserting each file?
>>>>>
>>>>>
>>>>>
>>>>> "Jezebel" wrote:
>>>>>
>>>>>> 1. Your inputters should be using the the .dot files as templates, so
>>>>>> the
>>>>>> files you get back should be .doc files. If not, you haven't explained
>>>>>> to
>>>>>> them well enough how to install the and use the templates.
>>>>>>
>>>>>> 2. From your description, simply combining all the docs into one big
>>>>>> one
>>>>>> should be fine, particularly as it's just a yearly one-off and
>>>>>> presumably
>>>>>> you don't need to do anything with the finished document except print
>>>>>> it.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
>>>>>> news:0805C936-E19D-4E1E-AF48-0B12ABF85719[ at ]microsoft.com...
>>>>>>> Basically we have a group of inputters who record data that gets
>>>>>>> written
>>>>>>> in a
>>>>>>> journal for each date a meeting takes place. We have automated
>>>>>>> their
>>>>>>> job
>>>>>>> by
>>>>>>> creating .dot files for each form type for the journal entry and
>>>>>>> have
>>>>>>> text
>>>>>>> files inserted by macros that feed the majority of the templates.
>>>>>>> When
>>>>>>> they
>>>>>>> open Word we have a form where they enter the date and it grabs the
>>>>>>> text
>>>>>>> and
>>>>>>> completes the form and asks them any variable questions. It auto
>>>>>>> saves
>>>>>>> the
>>>>>>> file by date in a network folder. At the end of each year we need
>>>>>>> to
>>>>>>> combine
>>>>>>> all of these individual files into one document w/ page numbers and
>>>>>>> common
>>>>>>> headers and footers - also a TOC and Index with a title page. We
>>>>>>> don't
>>>>>>> see
>>>>>>> an easy way to page number w/o combining somehow. The document does
>>>>>>> not
>>>>>>> have
>>>>>>> graphics...mostly straight text w/ index markers and styles. There
>>>>>>> are
>>>>>>> macros which run our application, but they don't need to be there
>>>>>>> when
>>>>>>> it
>>>>>>> is
>>>>>>> combined.
>>>>>>>
>>>>>>> What do you think is the best way to handle this?
>>>>>>> Have I provided enough background info.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> "Jezebel" wrote:
>>>>>>>
>>>>>>>> 1. It would help if you explained why you need to combine the files
>>>>>>>> in
>>>>>>>> the
>>>>>>>> first place. What will you do with the compound document that you
>>>>>>>> can't
>>>>>>>> do
>>>>>>>> with the individual files?
>>>>>>>>
>>>>>>>> 2. 2000 pages isn't so massive anyway, unless the files contain a
>>>>>>>> lot
>>>>>>>> of
>>>>>>>> graphics or complex tables. You could just build an ordinary
>>>>>>>> document.
>>>>>>>>
>>>>>>>> 3. Why are you working with .dot files?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
>>>>>>>> news:4E56B824-23AF-4250-94F9-2EE5354FABF1[ at ]microsoft.com...
>>>>>>>>> I am creating a 2000 page book from several smaller files. I have
>>>>>>>>> a
>>>>>>>>> directory where there is a file named for each date the file was
>>>>>>>>> created.
>>>>>>>>> For example, 20060102, 20060105, etc.... Where the filenames are
>>>>>>>>> YYYYMMDD.
>>>>>>>>> There may not be a file for every date, but all files are named
>>>>>>>>> by
>>>>>>>>> date.
>>>>>>>>> I
>>>>>>>>> would like to avoid master documents because of corruption
>>>>>>>>> issues.
>>>>>>>>> My
>>>>>>>>> thought was to create a document with my headers and page numbers
>>>>>>>>> for
>>>>>>>>> each
>>>>>>>>> months worth of files. In each month document I need a macro that
>>>>>>>>> would
>>>>>>>>> go
>>>>>>>>> out and look to the directory and insert each file in the month
>>>>>>>>> directory
>>>>>>>>> into the new file in sequencial order as a linked file. The
>>>>>>>>> field
>>>>>>>>> codes I
>>>>>>>>> am
>>>>>>>>> looking to drop are { INCLUDETEXT "U:\\Project\\20060102.dot"},
>>>>>>>>> etc...
>>>>>>>>> so
>>>>>>>>> that the macro would just read the files in the folder and insert
>>>>>>>>> the
>>>>>>>>> includetext field for each file in the folder in order. When I
>>>>>>>>> look
>>>>>>>>> at
>>>>>>>>> the
>>>>>>>>> final document for each month it would be all data for all dates,
>>>>>>>>> but I
>>>>>>>>> could
>>>>>>>>> update the files individually and would automatically update the
>>>>>>>>> month
>>>>>>>>> document.
>>>>>>>>>
>>>>>>>>> Is anything like this possible? Is there a better way to do such
>>>>>>>>> a
>>>>>>>>> document
>>>>>>>>> creation?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>
>>>>
>>
>>
>>

--
Russ

drsmN0SPAMikleAThotmailD0Tcom.INVALID

Re: Creating a Large Document using Insert File Link
NYSA-HD 01.09.2006 17:39:01
I tried the suggestion of Doug's and Russ, but it still ran the macros. I
tried it before the Target command and after. I also tried it at the
beginning under the Dim statements. I think I need to disable all macros in
the documents inserted not just the auto ones. How would I do that?


"Doug Robbins - Word MVP" wrote:

[Quoted Text]
> OK, I thought it was the macro security warning to which you were referring,
> but on re-reading you post see what it is.
>
> See the article "How can I prevent Word from running macros automatically
> when I create a new instance of Word, open a Word document or create a new
> one?" at:
>
> http://www.word.mvps.org/FAQs/InterDev/DisableAutoMacros.htm
>
>
> --
> 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
>
> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
> news:1B5AC737-46F0-4760-8DC4-51CC601674DB[ at ]microsoft.com...
> > This solution doesn't work b/c they are all trusted macros. Any other
> > ideas
> > to change the macro to insert files as linked objects?
> >
> >
> >
> > "Doug Robbins - Word MVP" wrote:
> >
> >> Set the macro security level to High (Tools>Macro>Security), temporarily
> >> if
> >> necessary, then the macros in the documents will be ignored.
> >>
> >> --
> >> 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
> >>
> >> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
> >> news:4E7D679C-8120-4E0F-9F2F-F1A9B37FA1B3[ at ]microsoft.com...
> >> > This is exactly what I wanted, but I have one issue. The doc files I
> >> > am
> >> > inserting have inherited macros. How can the code below insert the
> >> > files
> >> > w/o
> >> > the macros or better yet as Links to the original documents? When I
> >> > run
> >> > the
> >> > code as is all my dialogue boxes from the macros pop up, and I will no
> >> > longer
> >> > need them at this point.
> >> >
> >> > I really appreciate the help with this.
> >> >
> >> >
> >> >
> >> > "Doug Robbins - Word MVP" wrote:
> >> >
> >> >> If you put all of the documents in a folder by themselves, a macro
> >> >> containing the following code should insert each of them into a new
> >> >> document
> >> >> in the date order:
> >> >>
> >> >> Dim MyPath As String
> >> >>
> >> >> Dim MyName As String
> >> >>
> >> >> Dim Source As Document, Target As Document
> >> >>
> >> >> Dim SourceFile As Range
> >> >>
> >> >> Dim i As Long
> >> >>
> >> >> Dim FileList As Document
> >> >>
> >> >> Set FileList = Documents.Add
> >> >>
> >> >> '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
> >> >>
> >> >> 'get files from the selected path
> >> >>
> >> >> 'and insert them into the doc
> >> >>
> >> >> MyName = Dir$(MyPath & "*.*")
> >> >>
> >> >> Do While MyName <> ""
> >> >>
> >> >> Selection.InsertAfter MyName & vbCr
> >> >>
> >> >> MyName = Dir
> >> >>
> >> >> Loop
> >> >>
> >> >> 'Sort the list of files
> >> >>
> >> >> FileList.Range.Sort SortFieldType:=wdSortFieldAlphanumeric,
> >> >> FieldNumber:="Paragraphs"
> >> >>
> >> >> 'Delete the empty paragraph that will be at the top of the list of
> >> >> files
> >> >>
> >> >> FileList.Paragraphs(1).Range.Delete
> >> >>
> >> >> 'Start a new document into which each of the others will be inserted
> >> >>
> >> >> Set Target = Documents.Add
> >> >>
> >> >> 'Iterate through the list of files, getting the name of each file,
> >> >> opening
> >> >> it
> >> >>
> >> >> 'and inserting its contents into the Target document
> >> >>
> >> >> For i = 1 To FileList.Paragraphs.Count
> >> >>
> >> >> Set SourceFile = FileList.Paragraphs(i).Range
> >> >>
> >> >> SourceFile.End = SourceFile.End - 1
> >> >>
> >> >> Set Source = Documents.Open(MyPath & SourceFile.Text)
> >> >>
> >> >> Target.Range.InsertAfter Source.Range.FormattedText
> >> >>
> >> >> Source.Close wdDoNotSaveChanges
> >> >>
> >> >> Next i
> >> >>
> >> >>
> >> >>
> >> >> Also see the article "Print all documents in a given folder to a
> >> >> single
> >> >> print file" at:
> >> >>
> >> >> http://www.word.mvps.org/FAQs/MacrosVBA/PrintAllDocsInFldr.htm
> >> >>
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> 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
> >> >>
> >> >> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
> >> >> news:4EB857B5-B768-4A05-9472-107C8999795C[ at ]microsoft.com...
> >> >> > I'm sorry, you were right the outputted files are .doc files named
> >> >> > for
> >> >> > the
> >> >> > date YYYYMMDD.doc
> >> >> >
> >> >> > What is the easiest way to combine them all in date order w/o
> >> >> > manually
> >> >> > inserting each file?
> >> >> >
> >> >> >
> >> >> >
> >> >> > "Jezebel" wrote:
> >> >> >
> >> >> >> 1. Your inputters should be using the the .dot files as templates,
> >> >> >> so
> >> >> >> the
> >> >> >> files you get back should be .doc files. If not, you haven't
> >> >> >> explained
> >> >> >> to
> >> >> >> them well enough how to install the and use the templates.
> >> >> >>
> >> >> >> 2. From your description, simply combining all the docs into one
> >> >> >> big
> >> >> >> one
> >> >> >> should be fine, particularly as it's just a yearly one-off and
> >> >> >> presumably
> >> >> >> you don't need to do anything with the finished document except
> >> >> >> print
> >> >> >> it.
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >>
> >> >> >> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
> >> >> >> news:0805C936-E19D-4E1E-AF48-0B12ABF85719[ at ]microsoft.com...
> >> >> >> > Basically we have a group of inputters who record data that gets
> >> >> >> > written
> >> >> >> > in a
> >> >> >> > journal for each date a meeting takes place. We have automated
> >> >> >> > their
> >> >> >> > job
> >> >> >> > by
> >> >> >> > creating .dot files for each form type for the journal entry and
> >> >> >> > have
> >> >> >> > text
> >> >> >> > files inserted by macros that feed the majority of the templates.
> >> >> >> > When
> >> >> >> > they
> >> >> >> > open Word we have a form where they enter the date and it grabs
> >> >> >> > the
> >> >> >> > text
> >> >> >> > and
> >> >> >> > completes the form and asks them any variable questions. It auto
> >> >> >> > saves
> >> >> >> > the
> >> >> >> > file by date in a network folder. At the end of each year we
> >> >> >> > need
> >> >> >> > to
> >> >> >> > combine
> >> >> >> > all of these individual files into one document w/ page numbers
> >> >> >> > and
> >> >> >> > common
> >> >> >> > headers and footers - also a TOC and Index with a title page. We
> >> >> >> > don't
> >> >> >> > see
> >> >> >> > an easy way to page number w/o combining somehow. The document
> >> >> >> > does
> >> >> >> > not
> >> >> >> > have
> >> >> >> > graphics...mostly straight text w/ index markers and styles.
> >> >> >> > There
> >> >> >> > are
> >> >> >> > macros which run our application, but they don't need to be there
> >> >> >> > when
> >> >> >> > it
> >> >> >> > is
> >> >> >> > combined.
> >> >> >> >
> >> >> >> > What do you think is the best way to handle this?
> >> >> >> > Have I provided enough background info.
> >> >> >> >
> >> >> >> >
> >> >> >> >
> >> >> >> > "Jezebel" wrote:
> >> >> >> >
> >> >> >> >> 1. It would help if you explained why you need to combine the
> >> >> >> >> files
> >> >> >> >> in
> >> >> >> >> the
> >> >> >> >> first place. What will you do with the compound document that
> >> >> >> >> you
> >> >> >> >> can't
> >> >> >> >> do
> >> >> >> >> with the individual files?
> >> >> >> >>
> >> >> >> >> 2. 2000 pages isn't so massive anyway, unless the files contain
> >> >> >> >> a
> >> >> >> >> lot
> >> >> >> >> of
> >> >> >> >> graphics or complex tables. You could just build an ordinary
> >> >> >> >> document.
> >> >> >> >>
> >> >> >> >> 3. Why are you working with .dot files?
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >>
> >> >> >> >> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
> >> >> >> >> news:4E56B824-23AF-4250-94F9-2EE5354FABF1[ at ]microsoft.com...
> >> >> >> >> >I am creating a 2000 page book from several smaller files. I
> >> >> >> >> >have
> >> >> >> >> >a
> >> >> >> >> > directory where there is a file named for each date the file
> >> >> >> >> > was
> >> >> >> >> > created.
> >> >> >> >> > For example, 20060102, 20060105, etc.... Where the filenames
> >> >> >> >> > are
> >> >> >> >> > YYYYMMDD.
> >> >> >> >> > There may not be a file for every date, but all files are
> >> >> >> >> > named
> >> >> >> >> > by
> >> >> >> >> > date.
> >> >> >> >> > I
> >> >> >> >> > would like to avoid master documents because of corruption
> >> >> >> >> > issues.
> >> >> >> >> > My
> >> >> >> >> > thought was to create a document with my headers and page
> >> >> >> >> > numbers
> >> >> >> >> > for
> >> >> >> >> > each
> >> >> >> >> > months worth of files. In each month document I need a macro
Re: Creating a Large Document using Insert File Link
"Doug Robbins - Word MVP" <dkr[ at ]REMOVECAPSmvps.org> 01.09.2006 20:10:34
Just what macros are being run?

--
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

"NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
news:939FF43C-8FE5-43E9-88B5-BED7B342D440[ at ]microsoft.com...
[Quoted Text]
>I tried the suggestion of Doug's and Russ, but it still ran the macros. I
> tried it before the Target command and after. I also tried it at the
> beginning under the Dim statements. I think I need to disable all macros
> in
> the documents inserted not just the auto ones. How would I do that?
>
>
> "Doug Robbins - Word MVP" wrote:
>
>> OK, I thought it was the macro security warning to which you were
>> referring,
>> but on re-reading you post see what it is.
>>
>> See the article "How can I prevent Word from running macros automatically
>> when I create a new instance of Word, open a Word document or create a
>> new
>> one?" at:
>>
>> http://www.word.mvps.org/FAQs/InterDev/DisableAutoMacros.htm
>>
>>
>> --
>> 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
>>
>> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
>> news:1B5AC737-46F0-4760-8DC4-51CC601674DB[ at ]microsoft.com...
>> > This solution doesn't work b/c they are all trusted macros. Any other
>> > ideas
>> > to change the macro to insert files as linked objects?
>> >
>> >
>> >
>> > "Doug Robbins - Word MVP" wrote:
>> >
>> >> Set the macro security level to High (Tools>Macro>Security),
>> >> temporarily
>> >> if
>> >> necessary, then the macros in the documents will be ignored.
>> >>
>> >> --
>> >> 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
>> >>
>> >> "NYSA-HD" <NYSAHD[ at ]discussions.microsoft.com> wrote in message
>> >> news:4E7D679C-8120-4E0F-9F2F-F1A9B37FA1B3[ at ]microsoft.com...
>> >> > This is exactly what I wanted, but I have one issue. The doc files
>> >> > I
>> >> > am
>> >> > inserting have inherited macros. How can the code below insert the
>> >> > files
>> >> > w/o
>> >> > the macros or better yet as Links to the original documents? When I
>> >> > run
>> >> > the
>> >> > code as is all my dialogue boxes from the macros pop up, and I will
>> >> > no
>> >> > longer
>> >> > need them at this point.
>> >> >
>> >> > I really appreciate the help with this.
>> >> >
>> >> >
>> >> >
>> >> > "Doug Robbins - Word MVP" wrote:
>> >> >
>> >> >> If you put all of the documents in a folder by themselves, a macro
>> >> >> containing the following code should insert each of them into a new
>> >> >> document
>> >> >> in the date order:
>> >> >>
>> >> >> Dim MyPath As String
>> >> >>
>> >> >> Dim MyName As String
>> >> >>
>> >> >> Dim Source As Document, Target As Document
>> >> >>
>> >> >> Dim SourceFile As Range
>> >> >>
>> >> >> Dim i As Long
>> >> >>
>> >> >> Dim FileList As Document
>> >> >>
>> >> >> Set FileList = Documents.Add
>> >> >>
>> >> >> '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
>> >> >>
>> >> >> 'get files from the selected path
>> >> >>
>> >> >> 'and insert them into the doc
>> >> >>
>> >> >> MyName = Dir$(MyPath & "*.*")
>> >> >>
>> >> >> Do While MyName <> ""
>> >> >>
>> >> >> Selection.InsertAfter MyName & vbCr
>> >> >>
>> >> >> MyName = Dir
>> >> >>
>> >> >> Loop
>> >> >>
>> >> >> 'Sort the list of files
>> >> >>
>> >> >> FileList.Range.Sort SortFieldType:=wdSortFieldAlphanumeric,
>> >> >> FieldNumber:="Paragraphs"
>> >> >>
>> >> >> 'Delete the empty paragraph that will be at the top of the list of
>> >> >> files
>> >> >>
>> >> >> FileList.Paragraphs(1).Range.Delete
>> >> >>
>> >> >> 'Start a new document into which each of the others will be
>> >> >> inserted
>> >> >>
>> >> >> Set Target = Documents.Add
>> >> >>
>> >> >> 'Iterate through the list of files, getting the name of each file,
>> >> >> opening
>> >> >> it
>> >> >>
>> >> >> 'and inserting its contents into the Target document
>> >> >>
>> >> >> For i = 1 To FileList.Paragraphs.Count
>> >> >>
>> >> >> Set SourceFile = FileList.Paragraphs(i).Range
>> >> >>
>> >> >> SourceFile.End = SourceFile.End - 1
>> >> >>
>> >> >> Set Source = Documents.Open(MyPath & SourceFile.Text)
>> >> >>
>> >> >> Target.Range.InsertAfter Source.Range.FormattedText
>> >> >>
>> >> >> Source.Close wdDoNotSaveChanges
>> >> >>
>> >> >> Next i
>> >> >>
>> >> >>
>> >> >>
>> >> >> Also see the article "Print all documents in a given folder to a
>> >> >> single
>> >> >> print file" at:
>> >> >>
>> >> >>