views:

1115

answers:

1

I have a problem moving a Word template from Word 2003 to Word 2007

The code which I need to convert is

Sub Standardbrev()

    Documents.Add Template:= _
        "p:\setup\stdbrev.DOT", NewTemplate:= _
        False

    mask "<Navn>", False
    mask "<Adresse>", False
    mask "<Postby>", False
    mask "<att>", True
    mask "<Jura Nr>", False
    mask "<Vedr>", False
    mask "<Jurist>", False
End Sub

Edit, problems: When I try to copy/paste the code to a dotx document I get a compile error saying:

Sub or Function not defined.

If I outcomment the maskpart I can run the macro and it opens the stdbrev.DOT file in a new window

Edit: What it do in 2003: When you run the macro a 7 boxes (1 for each mask) pop up where you can fill info into them. The info the replaces the mask fields in the document

Hope this explains my problem

Edit: I found the solution, I misunderstood some of the code and did not know that mask was a function written by someone else a long time ago. Sorry for posting this noobish question

+2  A: 

mask is not a built-in function. This function should be defined somewhere in a module and you also have to copy this function to the Word 2007 document (That is why you get the error "Sub or Function not defined."). You can see where this function is defined by right-clicking on mask and then selecting Definition.

However, the easiest way to "migrate" this would be to simply open your Word 2003 document in Office 2007 and then save it as either .dotm or .docm file (depending whether you want to create a template or a regular document).

0xA3