Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Interfacing with Word
Message
From
19/09/2005 10:40:53
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8 SP1
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01050844
Message ID:
01050865
Views:
14
>I have a project that requires the printing of several Word docs in groups or packects. I have values that need to be printed on a page by themselves and included at the beginning of each packet. The solution I developed was to print a VFP report with the name and address followed by a COM call to word to open and print the word doc and subsequent word docs included in the pack. Loop. The flaw is that ALL the VFP reports print before the word docs. I need the order to correct and maintained.
>
>To correct the problem, I would like to insert a new page at the beginning of the first word doc that would include the address info etc. and insert subsequent docs at the end and print.
>
>Any help would be appreciated.
>
>Joe

You can use bookmarked templates, InsertFromFile or AddFromFile instead. ie: Something like:
#Define wdNormalView	1
#Define wdOutlineView	2
#Define wdPrintView	3
#Define wdPrintPreview	4
#Define wdMasterView	5

lcTemplate = 'c:\temp\master.doc'
lcDoc1 = "c:\temp\w1.doc"
lcDoc2 = "c:\temp\w2.doc"
lcDoc3 = "c:\temp\w3.doc"

oWord=Createobject('Word.Application')
With oWord
  .DisplayAlerts = .F.
  *!*	 .Documents.add(m.lcTemplate)
  .Documents.Add
  With .ActiveDocument
    .ActiveWindow.ActivePane.View.Type = wdMasterView
    .Subdocuments.AddFromFile(m.lcDoc1)
    .Subdocuments.AddFromFile(m.lcDoc2)
    .Subdocuments.AddFromFile(m.lcDoc3)
    .ActiveWindow.View.Type = wdPrintView
  Endwith
  .Visible = .T.
Endwith

* or
oWord=Createobject('Word.Application')
With oWord
  .DisplayAlerts = .F.
  .Documents.Add(m.lcTemplate)
  With .ActiveDocument
    .Bookmarks("doc1").Range.InsertFile(m.lcDoc1)
    .Bookmarks("doc2").Range.InsertFile(m.lcDoc2)
    .Bookmarks("doc3").Range.InsertFile(m.lcDoc3)
  Endwith
  .Visible = .T.
Endwith
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform