Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.pagelayout
[email protected] mikewill4@gmail.com is offline
external usenet poster
 
Posts: 2
Default Batch-Insert for Master Doc -- code not working

I found this code in an earlier thread, posted by Doug Robbins, to
batch add files to a master document, and I'm getting a syntax error.
Can someone please help? Using Word 2003 SP2.

-------------------------
Dim Source as Document, Target as Document, i as Integer

Set Target = Documents.Add
For i = 1 to 75
Set Source=Documents.Open "[Drive:\Path]" & Format(i, "00") &
".doc"
Target.Range.InsertAfter.Source.Range
Source.Close wdDoNotSaveChanges
Next i

I'm using this line

Set Source = Documents.Open "C:\Documents and Settings\williamsmi\My
Documents\MASSA\PRESS\KIT\" & Format(i, "00") & ".doc"

and getting a Compile error, Expected: End of Statement, with the path
highighted.

THANKS

  #2   Report Post  
Posted to microsoft.public.word.pagelayout
Cindy M. Cindy M. is offline
external usenet poster
 
Posts: 2,416
Default Batch-Insert for Master Doc -- code not working

I'm using this line

Set Source = Documents.Open "C:\Documents and Settings\williamsmi\My
Documents\MASSA\PRESS\KIT\" & Format(i, "00") & ".doc"

and getting a Compile error, Expected: End of Statement, with the path
highighted.

Is it also on two lines in your code module, exactly as I see it in your
message? If you put it on one line, that should help?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :-)

  #3   Report Post  
Posted to microsoft.public.word.pagelayout
[email protected] mikewill4@gmail.com is offline
external usenet poster
 
Posts: 2
Default Batch-Insert for Master Doc -- code not working

In my code it's all on one line. There's no break between "My " and
"Documents" -- I just couldn't figure out how to show that in a post.

Cindy M. wrote:
I'm using this line

Set Source = Documents.Open "C:\Documents and Settings\williamsmi\My
Documents\MASSA\PRESS\KIT\" & Format(i, "00") & ".doc"

and getting a Compile error, Expected: End of Statement, with the path
highighted.

Is it also on two lines in your code module, exactly as I see it in your
message? If you put it on one line, that should help?


  #4   Report Post  
Posted to microsoft.public.word.pagelayout
Cindy M. Cindy M. is offline
external usenet poster
 
Posts: 2,416
Default Batch-Insert for Master Doc -- code not working

In my code it's all on one line. There's no break between "My " and
"Documents" -- I just couldn't figure out how to show that in a post.

No problem - just wanted to eliminate the "obvious" first :-)

OK, I think I see it, now. Note the parentheses for all the arguments
following .Open

Set Source = Documents.Open("C:\Documents and Settings\williamsmi\My
Documents\MASSA\PRESS\KIT\" & Format(i, "00") & ".doc")

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :-)

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MULTIPLE INSTANCES OF THE SAME BOOKMARK IN A USER FORM Carol Microsoft Word Help 20 October 3rd 06 12:41 AM
Insert a text box based on an if then else code BLansinger Mailmerge 3 April 22nd 05 12:37 PM
Ole Objects inserted into Word SmogerP Mailmerge 9 April 18th 05 09:09 PM
UPC BAR CODE davek Microsoft Word Help 4 March 22nd 05 11:16 PM
Insert File not working Debutante New Users 13 January 29th 05 01:25 AM


All times are GMT +1. The time now is 04:30 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"