AccesSoft - Articles - Conclusion given in Word
Main | Articles | Links | Map

Example of the conclusion given from Access in Word

Sometimes appear to situations, when is required automatically contribute given in one of the standard document: official note, letter, agreement and t. d. Moreover not always such documents possible to form, using reports Access. For instance:

  • it is required form the agreement, which, as a rule, represents itself rather long text document, in which it is necessary to insert several чисел or lines for instance date.
  • it is necessary to provide the possibility of the manual editing the text of the document. For instance, exists the standard pattern of the document, which user must have a possibility to edit. If use the report Access, that come to open the user an access to source code.
  • the document must be saved in the manner of text file (the report Access can be is only typed). Sometimes be and such term.

Usually conclusion of the report in the document Word use, when necessary manually to correct the report data. Most often, herewith s the pattern of the document and then software is inserted in necessary places text. This more simply, than completely software to form whole document though possible and such.

In general, each document Microsoft Word is founded on pattern. The Pattern defines the main structure of the document and contains adjusting the document such as elements автотекста, fonts, fixed combinations of the keys, макросы, menu, parameters of the page, formatting and styles. In our event, necessary simply to create the model of the report just as this is done in Access. For this create the usual document Word, then in menu File Save what choose the type of the file Pattern of the document. As a result we shall get the document Word with extension .dot pattern

For editing the pattern better his(its) open not double snub, as usual document, but for instance, through contextual menu: right button and choose the point to open. Otherwise in an effort conservations to come again to assign the format of the document pattern (.dot), otherwise he will is preserved as usual document Word (.doc).

As example создадим the pattern a requisition customer. Arrange his(its) possible for instance so: create the headline, then table, where will are inserted requisitions. Insert given better in table, since in this case if text not влезет in width column, that column will automatically increase on height. But here is if insert the text simply in given place then under similar situation not fitted given show up with new line that will change the model of the pattern.

But now strictly about technologies of the insertion of the text in necessary place. To insert the text, first it is necessary to define the place, where he must be inserted. In given example this is done with the help of Bookmark (peer into menu of the document Word: Insertion Bookmark)

The Bookmark this element of the document, which is assigned unique name. This name possible to use for the following references. For instance, possible use the bookmark for determination of the text, which necessary to check later. To in next time not to search for the givenned text in all document, possible go to him by means of dialogue window Bookmark.

In our event bookmark are an elements of the pattern, chosen in italics (peer into file Dot). They much simply:

  • Select element, which follows to fix bookmark for instance курсивный text Customer
  • In menu Insertion choose command a Bookmark
  • In field Name bookmarks will enter or choose the necessary name in this instance enter the name Customer . The Name of the bookmark must begin with letters, in him can be used numerals, but must not be a gap. If it will take to separate the word in name of the bookmark, possible use the sign of the underlining, for instance: Glavnyy_zakazchik.
  • Press the button to Add.

Have In total got the bookmark with name Customer . In principle, possible was simply install the cursor in necessary place and aforesaid image to create the bookmark. But then for viewing, where what bookmark is installed in the document it is necessary will be through menu Insertion Bookmark to choose the name of the bookmark and press the button to Go. This uncomfortably, more simply and нагляднее to create the of the same name text in the document.

Now remained to create the function, which opened the created pattern Word, inserted there instead of bookmark necessary text and saved the created document under given by name. In past article was already told about way of the opening document Office. Remained only to realize, what address to bookmark. It Is Done this at characteristic of the document Bookmarks.Item For instance:

Bookmarks.Item("Zak").Range.Text = Nz(Zak, "")

Here goes address to bookmark under name Customer and with the help of her(its) characteristic Text she is assigned necessary importance in this instance contents of the of the same name field on the form. On event if in field no data, aplying function Nz(Importance, Importance if Null).

The Document s under name initial customer so given field must not be empty. This marketed at characteristic of the field (refer to constructor of the tables) Obligatory field - Yes . Besides, in cites an instance in the same way marketed procedure of searching for earlier created document with the help of standard function Dir. If document is not found, that s new document Word on base of the pattern

Set app = New Word.Application
app.Visible = True
app.Documents.Add strPathDot

but if such document exists, that is removed corresponding to message: Document with such name earlier was already created. Change him(it)? At choice Yes s new document in lieu thereof old, at choice No is opened old document

Set app = CreateObject("Word.Application")
With app
      .Visible = True
      .Documents.Open strPathWord
End With

Skachati example you may below...

Autor: Admin Size: 33 kB It Is Added: 16.07.2007

Main | Articles | Links | Map
найти комплексная раскрутка сайтов 100% финансовые гарантии.

Copyright 2007 - 2008 AccesSoft. All Rights Reserved