Das Notes Forum

Domino 9 und frühere Versionen => Entwicklung => Thema gestartet von: StoneCold am 02.11.04 - 14:28:19

Titel: Lotuscript type mismatch error
Beitrag von: StoneCold am 02.11.04 - 14:28:19
I have a local Lotus Notes application running ok in Notes 5.0.9, but when we run it in Notes Client 6.0.3, we get a type mismatch error in a function that tries to locate an embedded object in a form. The code is the following one:

Function ReturnSheet(doc As notesdocument) As Variant
Forall o In doc.EmbeddedObjects
If Ucase$(o.Name) = "LOTUSSPREADSHEET1" Then
Set RetornaSheet = o.object
Exit Forall
End If
End Forall
End Function

I tried the internet and I saw the same problem in some postings, but no solution till now. The object (a spreadsheet) is not in a rich text field, and it always exists.

Any help will be welcome
Titel: Re: Lotuscript type mismatch error
Beitrag von: Glombi am 02.11.04 - 14:35:49
Anstelle von
  Set RetornaSheet = o.object
musst Du
 Set RetornSheet = o.object
schreiben.
Titel: Re: Lotuscript type mismatch error
Beitrag von: Thomas Schulte am 02.11.04 - 14:47:37
Wohl eher ReturnSheet Glombi oder?

Thomas
Titel: Re: Lotuscript type mismatch error
Beitrag von: Glombi am 02.11.04 - 14:51:20
Besser ist das  ;D

Wahrscheinlich hat es das mal so eben runtergetippt und ich Depp sehe mir das auch noch an  >:(

Andreas
Titel: Re: Lotuscript type mismatch error
Beitrag von: Marinero Atlántico am 02.11.04 - 16:21:50

If Ucase$(o.Name) = "LOTUSSPREADSHEET1" Then

I think you should try
Code
If Ucase$(o.Name(0)) = "LOTUSSPREADSHEET1" Then

Its much easier to find such little bugs if you are using errorhandling.

Code
Function ReturnSheet(doc As notesdocument) As Variant
On Error goto iHaveVotedRepublicans

Forall o In doc.EmbeddedObjects
If Ucase$(o.Name) = "LOTUSSPREADSHEET1" Then
Set RetornaSheet = o.object
Exit Forall 
End If
End Forall
exit function

iHaveVotedRepublicans:
ReturnSheet = false
msgbox |Error in Function Returnsheet | & Error$(Err) & | in line:| & Cstr(Erl) 
' or use print
End Function


---
Zitat
Titel: Re: Lotuscript type mismatch error
Beitrag von: koehlerbv am 02.11.04 - 16:28:33
EmbeddedObject.Name ergibt einen String, Axel. Behandelst Du das als ein Array, baust Du erst einen type mismatch ein.

Bernhard
Titel: Re: Lotuscript type mismatch error
Beitrag von: Marinero Atlántico am 02.11.04 - 16:47:12
oh. Ich doov.
Sollte wirklich ein bischen die Klappe halten.
Wenn ich so viel arbeite, kann ich nicht so gut nachdenken ::) ;D

Titel: Re: Lotuscript type mismatch error
Beitrag von: Glombi am 02.11.04 - 16:51:23
Entscheidend ist der Hinweis, dass es unter R5 geht, unter R6 nicht.
Ich habe bereits einen Fall (auch hier gepostet), in dem sowas auch auftritt. Es scheint, als ob R6 etwas pingeliger als R5 wäre.

Warum wird eigentlich Variant als Rückgabewert und nicht NotesEmbeddedObject verwendet?
Vielleicht liegt es ja daran...

Andreas
Titel: Re: Lotuscript type mismatch error
Beitrag von: TMC am 02.11.04 - 23:18:20
Warum wird eigentlich Variant als Rückgabewert und nicht NotesEmbeddedObject verwendet?
Vielleicht liegt es ja daran...

I think that should be the solution (using NotesEmbeddedObject as return value) . I've had some trouble using embedded objects in both R5 and ND6 in combination with the Variant data type, too.
Strange, because Notes should convert the variant data type internal.