Shamil Salakhetdinov
shamil at users.mns.ru
Thu Jul 14 07:36:35 CDT 2005
Marty,
I did get your answer and I reinterpreted it in VB.NET and C# - my favorite
programing languages now.
I did put this interpretation here:
http://smsconsulting.spb.ru/shamil_s/topics/wordautomation.htm
Hope that's OK with you - if not just give me a push to clear/add any refs
on yourself in this topic.
Shamil
P.S. One can see from posted topic why VBA/VB.NET are the most suitable for
automation programming....
----- Original Message -----
From: "MartyConnelly" <martyconnelly at shaw.ca>
To: "Discussion of Hardware and Software issues"
<dba-tech at databaseadvisors.com>
Sent: Wednesday, July 13, 2005 9:19 PM
Subject: Re: [dba-Tech] Yet another Word question
> Odd I just answered a similar question on Access-L
>
> Here is one method, it just inserts one word doc after the other.
> Watch closing word down you may have several copies of word
> running so check task manger processes.
>
> You can can change insertion point to be bookmark, paragraph
> or even clipboard via a search for a Text String strInsertDesc
> rather than a straight character count.
>
> AppWord.Selection.Paste
> AppWord.ActiveDocument.Content.InsertAfter Text:=strInsertDesc
>
>
> Sub CreateDocumentWord()
> ' Save multiple Word doc files into one.
> Dim AppWord As Object
> Dim InsertPosition As Long
> Set AppWord = CreateObject("Word.Application")
> 'empty doc to start
> AppWord.Documents.Add
> 'copy first doc at character position
> InsertPosition = AppWord.ActiveDocument.Characters.Count - 1
> Debug.Print InsertPosition
> AppWord.ActiveDocument.Range.InsertFile _
> FileName:="C:\WordVBA\Copy Text to Insert in the Word Document.doc"
> 'copy second doc at next character position
> InsertPosition = AppWord.ActiveDocument.Characters.Count - 1
> Debug.Print InsertPosition
> AppWord.ActiveDocument.Range(InsertPosition).InsertFile _
> FileName:="C:\WordVBA\David.doc"
> 'save outuput file
> Dim strfilename As String
> strfilename = "C:\WordVBA\" & "OutputWord"
> strfilename = strfilename & Format(Now, "yyyymmddhhmmss") & ".doc"
> AppWord.ActiveDocument.SaveAs (strfilename)
> Set AppWord = Nothing
> End Sub
>
> Arthur Fuller wrote:
>
> >Assuming that Word is already opened programmatically from Access, with a
> >document open, I now want to open two more files in Word. How might I do
> >that. Would it simply be...
> >
> > objWord.Documents.Add .... plus the name of the file, and the same
again
> >with the name of the other file.
> >
> >Arthur
> >
> >_______________________________________________
> >dba-Tech mailing list
> >dba-Tech at databaseadvisors.com
> >http://databaseadvisors.com/mailman/listinfo/dba-tech
> >Website: http://www.databaseadvisors.com
> >
> >
> >
> >
>
> --
> Marty Connelly
> Victoria, B.C.
> Canada
>
>
>
> _______________________________________________
> dba-Tech mailing list
> dba-Tech at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/dba-tech
> Website: http://www.databaseadvisors.com