PLZ Help me for vb.net code

-I am getting error like as follows
-[No compiled code to run
error BC30734: ‘suggestions’ is already declared as a parameter of this method. At line 17]
-How can i solve?
-The code as follows,
-Try
isreadonly = True
isVisible = False
missing = System.Reflection.Missing.Value

app = New Microsoft.Office.Interop.Word.Application()
doc = app.Documents.Open(fileName, missing, isReadOnly, missing, missing, missing, missing, missing, missing, missing, missing, isVisible, missing, missing, missing, missing)

'check for typos
For Each err As Microsoft.Office.Interop.Word.Range In doc.SpellingErrors
SpellMistake_Position &= $“Misspelled word: {err.Text}, Position: Start: {err.Start}, End: {err.End}{Environment.NewLine}”

Dim myvariable As String = “Initial line” & Environment.NewLine
SpellMistake &= “-” & err.Text & Environment.NewLine

Dim suggestions As String = “” (((( getting error at this line)))
For Each suggestion As String In err.GetSpellingSuggestions()
suggestions &= suggestion & “, "
Next
suggestions = suggestions.TrimEnd(”, ".ToCharArray())

Dim myvariable As String = "Initial line" & Environment.NewLine           ((((((((getting error at this point ))))
suggestions &= $"-{err.Text} Suggestions: {suggestions}{Environment.NewLine}"

Next

'check for grammar
For Each grTypo As Microsoft.Office.Interop.Word.Range In doc.GrammaticalErrors

Dim myvariable As String = “Initial line” & Environment.NewLine
GrammarMistake &= “-” & grTypo.Text & Environment.NewLine
Next

'more…
'doc.CheckGrammar()
'doc.CheckSpelling()

doc=Nothing
app=Nothing
System.GC.Collect

Catch ex As Exception

End Try

This variable you are passing as an argument also and you are declaring in the code also using Dim suggestions

Change the name of the argument or in your code and this should work fine.

Thanks,
Ashok :slight_smile:

1 Like

Kindly mark the answer as solution if it works this will help community member with similar query!

Thanks,
Ashok :slight_smile:

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.