Skip to Content
0
Former Member
Oct 01, 2009 at 01:21 PM

office integration

44 Views

Hey,

I'm trying to set up a word document as a template in sap.

By configuring the necessary 'fields' in the word document template, I want it to be possible to automatic update future document witch the characteristics of the DIR using this template.

As you may know you can set up fieldsu2019 references in word 2007 by:

-go to insert tab

-click Quick Parts

-select Field

-set categories: links and references

-select Link

-select field codes

-paste LINK SAP.OLELinkServer.ItemObject.1 "SAPOLELinkServerDMS" "Char_Value.DRAW.017.ZCH_PRDLINE.1" \a \t

-OK

Where ZCH_PRDLINE is a character defined in the additional fields of the DIR

Where .1 is the first value entered in this character fields

In advance I don't know how many values will be filled in, so using visual basic Word 2007 I made a loop to get all the values.

Suppose there are 3 values filled in (3 is an example, next time it can be 8...) and the loops runs to get the fourth value, then a warning occur 'Word is unable to create a link to the object you specified. Please insert the object directly into your file without creating a link' the value I get is 'Error! Not a valid link.' It is normal i get the warning, but I want to get rid off it...

I tried to disable warnings in visual basic with the command 'Applicaton.DisplayAlerts=False' and with 'Application.DicplayAlerts=wdAlertsNone'. I tried a try catch, but this is a warning not an error....

Does somebody know how to get the number of values that are filled in for a characteristic, so I can end the loop in time?

Is there a way to get the values as an array?

Thanks ,

Seba.