> Nicht aufregen... Im Zweifelsfall hast immer Du schuld... ;-)

Hallo,

Ja wie soll ich Dir den Code schicken?
Das Makro geht ja nicht...
Aber so quick and dirty einfach hier unten.
Aber nicht aufregen ... vor lauter basteln schaut er ziemlich dirty aus :-)

Danach ist der Code nochmal nur in ASP. Kann aber sein, da� ein paar
�nderungen im VBA-Code drinnen sind, die im ASP fehlen

'Dimension object variables
Dim objWord 'as Word.Application
Dim objDocument 'as Word.Document
Dim objErrors 'as Word.ProofreadingErrors
Dim objError 'as Word.Range
Dim wdSuggestions 'as Word.SpellingSuggestions
Dim wdSuggestion 'as Word.SpellingSuggestion
Dim strSubmission, strModified, intCounter
Dim WebServObj
Dim language, myLang, myThes, fehlertext, vorschlag
Const wdDoNotSaveChanges = 0




'Capture submitted text from Form or QueryString

strSubmission = TextBox3.Value
language = 1031



'Launch Word and create a new document
Set objWord = CreateObject("Word.Application")
Set objDocument = objWord.Documents.Add

'Insert the user's submitted text into the document
objDocument.Range.Text = CStr(strSubmission)
objDocument.Range.LanguageID = language

TextBox1.Value = objDocument.Range.LanguageID



'Retrieve and display spelling errors
Set objErrors = objDocument.SpellingErrors
If objErrors.Count Then 'there are errors

    For Each objError In objErrors
        'Display the misspelled word

       vorschlag = ""
        fehlertext = objError.Text
        'Get spelling suggestions for the word
        Set wdSuggestions = _
            objWord.GetSpellingSuggestions(objError.Text)
        If wdSuggestions.Count < 1 Then
            ListBox1.AddItem (fehlertext & " " & "Keine Vorschl�ge")
        Else
            intCounter = 0
            For Each wdSuggestion In wdSuggestions
                intCounter = intCounter + 1
                strModified = Replace(strSubmission, _
                    objError.Text, wdSuggestion.Name, 1, 1)
              vorschlag = vorschlag & " | " & wdSuggestion.Name
            Next
             ListBox1.AddItem (fehlertext & ":     " & vorschlag)
        End If

    Next
TextBox2.Value = objErrors.Count
    MsgBox ("Fertig")
Else 'no errors were found
    MsgBox "Keine Fehler gefunden."
End If

'Close running instance of Word and destroy objects
objWord.Quit wdDoNotSaveChanges
Set objDocument = Nothing
Set objWord = Nothing
Set objErrors = Nothing
Set wdSuggestions = Nothing



---- Nun ASP
<%


'Dimension object variables
dim objWord 'as Word.Application
dim objDocument 'as Word.Document
dim objErrors 'as Word.ProofreadingErrors
dim objError 'as Word.Range
dim wdSuggestions 'as Word.SpellingSuggestions
dim wdSuggestion 'as Word.SpellingSuggestion
dim strSubmission, strModified, intCounter
dim WebServObj
dim language, myLang, myThes
const wdDoNotSaveChanges = 0

     ' Get the IIsWebService Admin Object
     Set WebServObj = GetObject("IIS://localhost/W3svc/4")
     ' Enable the AspAllowOutOfProcComponents Parameter
     WebServObj.Put "AspAllowOutOfProcComponents", True

     ' Save the changed value to the metabase
     WebServObj.SetInfo
    'danach den Server neu starten!!!!


'Capture submitted text from Form or QueryString

strSubmission =  request.form(  "text" & right(
request.querystring("FeldID"),1 )  )
language = 1031

'Echo submission back to the user
with response
        .write "<b>Korrektur-Text:</b><br>"
        .write "&quot;" & strSubmission & "&quot;<br><br>"
end with

'Launch Word and create a new document
set objWord = server.createObject("Word.Application")
set objDocument = objWord.documents.add

'Insert the user's submitted text into the document
objDocument.Range.text = cstr(strSubmission)
objDocument.Range.languageID = language

response.write(objDocument.Range.languageID)
With objDocument
    If .LanguageDetected = True Then

            .LanguageDetected = False
            .DetectLanguage

    Else
        .DetectLanguage
    End If
    If .Range.LanguageID = language Then
       response.write("Das ist ein deutsches Dokument" &
objDocument.Range.languageID)
    Else
      response.write("Das ist KEIN deutsches Dokument " &
objDocument.Range.languageID)
    End If
End With


'Retrieve and display spelling errors
set objErrors = objDocument.spellingErrors
if objErrors.count then 'there are errors
        with response
                .write "<table><tr><td><b>Fehler:&nbsp;"
                .write "</b></td><td><b>Vorschl�ge</b></td></tr>"
        end with
        for each objError in objErrors
                'Display the misspelled word
                response.write "<tr valign=top><td>"
                response.write objError.Text & "</td><td>"
                'Get spelling suggestions for the word
                set wdSuggestions = _
                        objWord.getSpellingSuggestions(objError.text)
                if wdSuggestions.count < 1 then
                        response.write "Keine Vorschl�ge"
                else
                        intCounter = 0
                        for each wdSuggestion in wdSuggestions
                                intCounter = intCounter + 1
                                strModified = replace(strSubmission, _
                                        objError.text, wdSuggestion.name, 1, 1)
                                with response
                                        'Construct anchor tag
                                        .write "<a href=SpellCheck.asp?"
                                        .write "txtSubmit="
                                        .write server.URLEncode(strModified)
                                        .write " class='error'>" & wdSuggestion.name & 
"</a>"
                                end with
                                'Display a pipe-delimiter except at the end
                                if intCounter < wdSuggestions.count then
                                        response.write " | "
                                end if
                        next
                end if
                response.write "</td></tr>"
        next
        with response
                'Show the user number of errors found
                .write "</table>"
                .write "<br><b>" & objErrors.count
                .write " Rechtschreibfehler gefunden!</b>"
        end with
else 'no errors were found
        response.write "<b>Keine Fehler gefunden.</b>"
end if

'Close running instance of Word and destroy objects
objWord.Quit wdDoNotSaveChanges
set objDocument = Nothing
set objWord = Nothing
set objErrors = Nothing
set wdSuggestions = Nothing
%>


| [aspdecoffeehouse] als [email protected] subscribed
| http://www.aspgerman.com/archiv/aspdecoffeehouse/ = Listenarchiv
| Sie k�nnen sich unter folgender URL an- und abmelden:
| http://www.aspgerman.com/aspgerman/listen/anmelden/aspdecoffeehouse.asp

Antwort per Email an