View Single Post
  #8  
Old 15th May 2006, 10:26
Locher Locher is offline
Member
 
Join Date: Jul 2004
Posts: 33
Locher is on a distinguished road
Baan: BaanIVc4SP19 - DB: Informix 10 - OS: WIN2003
Thumbs up MS Word: Hole Kundenanschrift aus Baan...

Guten Tag Herr Seidel,

hier das Macro wordseitig:


*************************************************
'Funktion starten (dyn.SQL wird initialisiert)

BaanObj.ParseExecFunction B_DLL, B_Function


'einenSatz übertragen

B_Func = "fetch.query.result()"


' 1.Ergebnis wird gelesen
BaanObj.ParseExecFunction B_DLL, B_Func

'Abfrage auf Fehlercode

B_Error = BaanObj.Error

'zuweisen des Rückgabewertes

B_Return = BaanObj.Returnvalue

dll_dsca = B_Return

'Auslesen der Schleifenbedingung

B_err = Mid(dll_dsca, 298, 3)

If B_err = "err" Then

MsgBox ("Lieferantennummer bei Huttenlocher nicht gefunden!")


Else


Selection.InsertAfter Mid(dll_dsca, 1, 35) 'N1 Einfügen der Returnvariable an Kurserposition


Selection.InsertAfter Chr(13) ' Leerzeile
If Mid(dll_dsca, 36, 30) <> " " Then
Selection.InsertAfter Mid(dll_dsca, 36, 30) 'N2
Selection.InsertAfter Chr(13) ' Leerzeile
End If
Selection.InsertAfter Mid(dll_dsca, 66, 30) 'Str1
Selection.InsertAfter Chr(13) ' Leerzeile
If Mid(dll_dsca, 96, 30) <> " " Then
Selection.InsertAfter Mid(dll_dsca, 96, 30) 'Str2
Selection.InsertAfter Chr(13) ' Leerzeile
End If
Selection.InsertAfter Chr(13) ' Leerzeile

Selection.InsertAfter Mid(dll_dsca, 126, 30) 'PLZ+Ort1
Selection.InsertAfter Chr(13) ' Leerzeile

If Mid(dll_dsca, 156, 30) <> " " Then
Selection.InsertAfter Mid(dll_dsca, 156, 30) 'Ort2
Selection.InsertAfter Chr(13) ' Leerzeile
End If

If Mid(dll_dsca, 186, 30) <> "DEUTSCHLAND " Then
Selection.InsertAfter Mid(dll_dsca, 186, 30) 'Land
Selection.InsertAfter Chr(13) ' Leerzeile
End If


'Selection.InsertAfter Chr(13)
Selection.Collapse wdCollapseEnd


'Nach Übergabe der Daten Aufheben der Verbindung zu Baan

BaanObj.Quit 'Verbindung zu Baan beenden
Set BaanObj = Nothing 'Verbindung zu Baan beenden

End If


End Sub
Sub Terminate()

BaanObj.Quit 'Verbindung zu Baan beenden
Set BaanObj = Nothing 'Verbindung zu Baan beenden

End Sub
Sub Initialize()
Set BaanObj = CreateObject("Baan4.Application")
End Sub
********************************************************

... und hier die doku des Clients C:\Programme\baan\samples

This readme.txt file contains additional information about the Excel
spreadsheets installed in the samples directory.


Object Linking and Embedding (OLE) can be used to exchange data between BAAN IV
and Microsoft Excel. This is only possible if BAAN IV is running in the BAAN
Windows environment. Consequently, OLE cannot be used in the BX and BA
environments. To demonstrate the functionality of OLE, a number of spreadsheets
have been created by means of which Excel data can be loaded into BAAN IV. No
spreadsheets are available to demonstrate how BAAN IV data can be loaded into
Excel.

For the OLE integration between Microsoft Excel and BAAN IV, several
combinations of spreadsheets and DLLs (dynamic-link library) are used as
specified in the table below. The last column in this table specifies the
session code of the BAAN session in which the changes which have occurred as a
result of the OLE data exchange can be viewed.

Package Excel Spreadsheet BAAN IV DLL BAAN IV Session
------- ----------------- ----------- ---------------
Manufacturing mpsole.xls timpsole3280 timps3101m000
Distribution slsbudg.xls tdsstole0250 tdsst0250m000
Finance finbudg.xls tffbsole0300 tffbs1101m000

At the bottom of these spreadsheets, at least two tabs are available which can
be used to toggle between worksheets. If the OleBaan tab is selected, the
script which is linked to this spreadsheet is displayed. This script is
referred to as the Visual Basic Module and can be modified if desired. The
scripts behind the BAAN DLLs can only be accessed from within the spreadsheet.
The remaining tab(s) give(s) access to regular worksheets from which data can
be loaded into BAAN IV.

In these spreadsheets, the following steps must be executed to load data into
BAAN IV:

The mpsole.xls spreadsheet:
Enter the forecast data. Make sure that such data as plan code
is available in BAAN IV. Use the mouse to select the forecast which
must be loaded. Use the Baan Logo button to Download to BAAN button.

The slsbudg.xls spreadsheet:
Enter the budget data. Make sure that such data as sort code, year, and
year part are available in BAAN IV.
Use the mouse to select the budget data which must be loaded, highlight only
that data which you wish to update. Use the Baan Logo button
to Download to BAAN button.
Note: If, for example, the Quantity(Inventory Units) in period one
needs to be changed that field is selected. If you need to change
data for that period on all the worksheets the data in those columns
will also need to be highlighted.

The finbudg.xls spreadsheet:
Enter the financial data. Make sure that such data as company, budget,
and year are available in BAAN IV. Use the Baan Logo button to Download to BAAN button.
Note: Select all data that needs to be updated.


In Excel, it is possible to make several independent multiple selections
by simultaneously pressing the mouse and the <Ctrl> key. However, to
correctly load the data into BAAN, the selection should be limited to
one multi selection of rows and columns.

By default, the spreadsheets are stored in the c:\baan\samples directory.
If desired, they can be stored in another directory.

If desired, the spreadsheets can be modified. However, any modifications to
the spreadsheets must be supported by the Visual Basic script and the
related DLL. For example, if any rows or columns are added or inserted and
the data in these rows or columns is loaded into BAAN by means of the
Download to BAAN button, this data is either not loaded or be placed in the
wrong rows or columns because the structure of the modified spreadsheet does
not match the structure in the BAAN database. Consequently, all scripts and
spreadsheets must be tuned to the DLLs and the BAAN IV database structure.

Within BAAN IV, information can be retrieved regarding OLE Automation by
selecting one of the BAAN IV Tools options in the menu browser and selecting
the Contents option form the Help menu to display the general index. Next,
select the OLE Automation category to display OLE information. Press the
Relations button to display additional information. Such BAAN IV categories
as OLE Automation Server and Limitations are listed under the Subfunctions
heading.


***********************************************


Was für eine Verbindung zu Baan soll den bei Ihnen hergestellt werden?


Gruß
H.Locher
Reply With Quote