Personalization of the Editions

Editions GPMI are carried out under Word and Excel, starting from Modèles of documents located in the Programmes repertory (in general, C:\Program Files\GPMI)

These models are as follows :

Model

Use

editions_gpmi.xls

Editions intern various

gpmi_bl.doc

BL Clients

gpmi_cde.doc

Customer orders

gpmi_cdef.doc

Orders Suppliers

gpmi_dast.doc

DA of subcontracting

gpmi_dev.doc

Estimate Customers

gpmi_etiq.doc

Labels (replaced by a specific Excel table)

gpmi_fac.doc

Invoices Customers

gpmi_istk.doc

Inventory Stocks

gpmi_of.doc

Work orders

gpmi_pstk.doc

Stocks with time limitation

gpmi_trt.Doc.

Drafts Customers

Word Editions

There are two manners of personalizing the editions under Word (gpmi_xxx.Doc.).

General presentation (colors, logos, sizes of characters, etc...)

Contents (published information)

General presentation

Open the Word document, for example gpmi_cde.Doc. :

You can directly modify your logo, the heading, the footer, to register your own co-ordinates there (double click on the zone of heading or footer to open it).

You can also modify in each cell of the tables :

Easy way : To make disappear the contents from a cell, put the color of the characters at white, thus, the zone will be published in white on white zone and will be invisible.

This stage, do not modify :

Contents

To modify the contents of the edition, it is a little more complicated, but it is possible. Indeed, the source code of the editor of finds in the model of the document. It is written in VBA (Visual BASIC for Applications), in other words in macros Excel or Word. With a little knowledge VBA, you will be able easily to adapt these editions to your need.

Reach the code of the edition by small Tools (or Outils)/Macro/Visual BASIC Editor or directly while supporting on Alt F11 :

Window VBA is then posted:

The goal of this document is not to make an introductory course to language VBA. You will find some with abundance on the Web But simply, I try to indicate the principal modifications to you which you will be able to make with very small few knowledge VBA.

The source code is organized in 2 modules :

The module accès_base is purely technical. It gives access to tables GPMI. You do not have, in theory, to intervene there. It is the same one for all the models of documents GPMI.

The Edition module contains the code specific to the edition. According to the models, it can contain several macros. That which interests you calls... Edition :

Sub Edition(bases, nomlog, num_cde)

Do not change the parameters of this subroutine ! GPMI could not any more launch it.

The edition is carried out in a simple way, by filling the cells of the tables of the document :

ActiveDocumentTables(1).Cell(1, 2).Range.Text corresponds to the first table of the document, and the text of the cell of line 1, column 2. One affects a value as follows to him :

ActiveDocumentTables(1).Cell(1, 2).Range.Text = "N°" & num_cde

The character " & " corresponds to the concatenation of character strings, here, one adds " N° " in front of the number of order, passed in parameter with the edition.

Each table of base GPMI corresponds to a particular structure. The heading of customer order, for example, is the EnteteCdeCli table and corresponds to structure " the CEC ". The module accès_base, in macro Sub dB _rechpos(nomfic$, nmoind), gives you the correspondence between the code of the structure and the name of table GPMI :

Yew nomfic$ = "the CEC" Then Set Tb = dB.OpenRecordset("EnteteCdeCli"): Yew nmoind = 1 Then TbIndex = "Cle_cce" Else Yew nmoind = 2 Then TbIndex = "Cle_cce1" Else Yew nmoind = 3 Then TbIndex = "Cle_cce2" Else TbIndex = "Cle_cce3"

Yew nomfic$ = "cbe" Then Set Tb = dB.OpenRecordset("EnteteBL"): Yew nmoind = 1 Then TbIndex = "Cle_cbe" Else Yew nmoind = 2 Then TbIndex = "Cle_cbe1" Else Yew nmoind = 3 Then TbIndex = "Cle_cbe2" Else TbIndex = "Cle_cbe3"

Yew nomfic$ = "cfe" Then Set Tb = dB.OpenRecordset("EnteteFact"): Yew nmoind = 1 Then TbIndex = "Cle_cfe" Else Yew nmoind = 2 Then TbIndex = "Cle_cfe1" Else Yew nmoind = 3 Then TbIndex = "Cle_cfe2" Else TbIndex = "Cle_cfe3"

Yew nomfic$ = "ccl" Then Set Tb = db.OpenRecordset("LigneCdeCli"): Yew nmoind = 1 Then tb.Index = "Cle_ccl" Else Yew nmoind = 2 Then tb.Index = "Cle_ccl1" Else Yew nmoind = 3 Then tb.Index = "Cle_ccl2" Else tb.Index = "Cle_ccl3"

Yew nomfic$ = "cbl" Then Set Tb = db.OpenRecordset("LigneBLCli"): Yew nmoind = 1 Then tb.Index = "Cle_cbl" Else Yew nmoind = 2 Then tb.Index = "Cle_cbl1" Else Yew nmoind = 3 Then tb.Index = "Cle_cbl2" Else tb.Index = "Cle_cbl3"

Yew nomfic$ = "cfl" Then Set Tb = db.OpenRecordset("LigneFactCli"): Yew nmoind = 1 Then tb.Index = "Cle_cfl" Else Yew nmoind = 2 Then tb.Index = "Cle_cfl1" Else Yew nmoind = 3 Then tb.Index = "Cle_cfl2" Else tb.Index = "Cle_cfl3"

Yew nomfic$ = "mvt" Then Set Tb = db.OpenRecordset("Movements"): Yew nmoind = 1 Then tb.Index = "Cle_mvt" Else Yew nmoind = 2 Then tb.Index = "Cle_mvt1" Else Yew nmoind = 3 Then tb.Index = "Cle_mvt2" Else tb.Index = "Cle_mvt3"

nomfic$ = "the CEC" > > Name of the structure

dB.OpenRecordset("EnteteCdeCli") > > table of base GPMI

Macro Sub dB _rechlec(nomfic$), for example, will indicate to you the connection between the elements of the structure and the corresponding fields of the table :

Yew nomfic$ = "the CEC" Then

cce.nc = Tb("nc")

the CECcc1t = Tb("cc1t")

the CECa11 = Tb("a11")

cce.a21 = Tb("a21")

cce.cp1 = Tb("cp1")

cce.v1 = Tb("v1")

cce.reg1 = Tb("reg1")

cce.pays1 = Tb("pays1")

cce.i1 = Tb("i1")

cce.statut = Tb("statute")

cce.n1 = Tb("n1")

the CECcc2t = Tb("cc2t")

the CECa12 = Tb("a12")

cce.a22 = Tb("a22")

cce.cp2 = Tb("cp2")

the CECv2 = Tb("v2")

etc...

the CEC.nc > > No of order

Field of the table : Tb("nc")

In this case, the element of the structure (nc) is the same one as that of the field of the table. It is not always true. Moreover, the same fields of the table them are not always comprehensible immediately.

An Excel file gives you the significance in light of these fields (Significance of the fields of the Base.xls).

With all these elements, you can be capable to modify to you same the macro Edition.

A manner simple to remove the edition of a data is to put its corresponding line in comment, by putting a simple dimension " ' " in front of the line :

'ActiveDocumentTables(3).Cell(line 2, 6).Range.Text = ccl.ct

This removes the posting of code VAT.

End of the macro safeguard the document carried out :

'sauvegarge document in the way of the base: name = cde_<num>.Doc.

msg1$ = bases & "\cde _" & Trim$ (num_cde)

ActiveDocument.Protect Password:="", NoReset: =False, Type:=2

ActiveDocument.SaveAs FileName:=msg1$, FileFormat: =wdFormatDocument _

, LockComments: =False, Password:="", AddToRecentFiles: =True, _

WritePassword: ="", ReadOnlyRecommended:=False, EmbedTrueTypeFonts:=False, _

SaveNativePictureFormat: =False, SaveFormsData:=False, SaveAsAOCELetter: = _

False

The document is protected from the modifications. To remove this protection definitively, put in comments the line :

ActiveDocument.Protect Password:="", NoReset: =False, Type:=2

By adding a dimension in front of :

'ActiveDocument.Protect Password:="", NoReset: =False, Type:=2

To safeguard under another name, and/or in another repertory that that of the base, change the line :

msg1$ = bases & "\cde _" & Trim$ (num_cde)

That Ci gives the way and the name of the document. You can modify the way while putting, for example :

msg1$ = "C:\mes commandes\cde _" & Trim$ (num_cde)

Excel Editions

As under Word, you can change the contents of the Excel editions. Those all Ci are a little " gross ", and correspond to a request directly placed in the cells of the Edition sheet.

Open Visual BASIC Editor, as in Word.

You will find :

This macro code_std is called by all the editions : she opens the base, carries out a request, places then the fields of the request in the tabeau Excel.

You will find in the Données_Techniques module the macro one :

Sub FamillesArt(bases, query1, query2)

Who will give you an example of personalization of the edition.

Sheets("Edition").Cells(J, 5) refers to the sheet " Edition ", for the cell of line " J " and column 5.

I hope that this small brief help will help you a little. If it is not sufficient, do not hesitate to contact me : admin@1dustrie.com

Joel Ollivier

To manage