Outlook form works on 2003 but not on 2000

  • Thread starter Thread starter Christian Kjær
  • Start date Start date
C

Christian Kjær

Hi all

I have designet an Outlook form in Outlook 2003 and it works very fine. But
when, I send it to my Outlook 2000 user it Only run some of the code. belov
I have postet the VBScript code. Can anybody se, what is wrong?

dim path

path = "J:\skabeloner\Outlook\Vikar\"

function startDokument(path)

dim objWord

dim objDoc

set objWord = createObject("Word.Application")

set objDoc = objword.documents.add(path)

objWord.visible = true


objWord.Selection.GoTo -1,,, "Fornavn"

objWord.Selection.TypeText
Item.UserProperties.item("FornavnTelefonscreening").value

on error resume next

objWord.Selection.GoTo -1,,, "Efternavn"

if err.number = 0 then

objWord.Selection.TypeText
Item.UserProperties.item("EfternavnTelefonscreening").value

objWord.Selection.GoTo -1,,, "Adresse"

objWord.Selection.TypeText
Item.UserProperties.item("AdrTelefonscreening").value

objWord.Selection.GoTo -1,,, "Postnummer"

objWord.Selection.TypeText
Item.UserProperties.item("PostnummerTelefonscreening").value

objWord.Selection.GoTo -1,,, "By"

objWord.Selection.TypeText
Item.UserProperties.item("ByTelefonscreening").value

end if

on error goto 0

'Sidehoved og sidefod

objWord.ActiveWindow.ActivePane.View.SeekView = 9

objWord.Selection.MoveDown 5, 1

objWord.Selection.TypeText
Item.UserProperties.item("KontoTelefonscreening").value

objWord.ActiveWindow.ActivePane.View.SeekView = 0

objWord.Selection.GoTo -1,,, "Kontor2"

objWord.Selection.TypeText
Item.UserProperties.item("KontoTelefonscreening").value

objWord.Selection.GoTo -1,,, "Kontor3"

objWord.Selection.TypeText
Item.UserProperties.item("KontoTelefonscreening").value

objWord.Selection.GoTo -1,,, "OprettetAf"

objWord.Selection.TypeText cStr(Item.UserProperties.item("Forfatter").value)

if Item.UserProperties.item("emailTelefonscreening").value <> "" then

objWord.Selection.GoTo -1,,, "text"

objWord.Selection.TypeText "Inden samtalen vil jeg sende dig en test pr.
e-mail som du skal løse. Jeg sender dig testen på " &
Item.UserProperties.item("emailTelefonscreening").value & "." & chr(13) &
chr(10) & "Har du ikke modtaget testen inden samtalen, skal du kontakte
mig."

else

objWord.Selection.GoTo -1,,, "text"

objWord.Selection.TypeText "I forbindelse med samtalen, vil du blive
præsenteret for en test I afd."

end if

dim txt

txt = Item.UserProperties.item("lblStart").value

txt = weekdayName(weekday(txt)) & " den " & cStr(formatdateTime(txt, 1))

objWord.Selection.GoTo -1,,, "Start"

objWord.Selection.TypeText txt

txt = timeValue(Item.UserProperties.item("lblStart").value)

objWord.Selection.GoTo -1,,, "tid"

objWord.Selection.TypeText cStr(txt)


objWord.Selection.GoTo -1,,, "Dato"

objWord.Selection.TypeText cStr(formatDateTime(Date, 1))



set objDoc = nothing

set objWord = nothing

end function

sub cmdBrevTilKandidat_click()

startDokument path & "Indkaldselsbrev.doc"

end sub

sub cmdMailTilKandidat_click()

startDokument path & "Indkaldselsmail.doc"

end sub



Any help would be appeciated.

Kind regards
Christian
 
Christian said:
Hi all

I have designet an Outlook form in Outlook 2003 and it works very fine. But
when, I send it to my Outlook 2000 user it Only run some of the code. belov
I have postet the VBScript code. Can anybody se, what is wrong?

In 2K3, you use

Item.UserProperties.item("PostnummerTelefonscreening").value

In 2K you have to write

Item.UserProperties.find("PostnummerTelefonscreening").value


You may want to

select case split(outlook.application.version,".")(0)
case 9
'2K stuff
case 11
'2K3 stuff
end select


You may further want to encapsulate this code so that you can write

p = getUserProperty(item,property)
setUserProperty item, property, value


HTH, Wolfram
 
Back
Top