A
Athlagan
Guest
Hello guys,
I am new at vb under studio and I am running into a problem that was easy to sort under VBA but puzzles me under Studio.
I am trying to create a VSTO Add-in for Word. I have a form which contains a combobox and I want to programmatically list the NameLocal (display value) and ID (value) of all languages of the system for which there is an ActiveSpelling Dictionary.
I locate this routine in the Form.Vb:
Private Sub PopulateMyLanguages()
Dim Cb As ComboBox = Me.Cbb_Languages
Dim MyLang As Microsoft.Office.Interop.Word.Language
For Each MyLang In Microsoft.Office.Interop.Word.Languages
If MyLang.ActiveSpellingDictionary.Path IsNot vbNullString Then
Cb.Items.Add(MyLang.NameLocal)
Cb.DisplayMember = MyLang.NameLocal
Cb.ValueMember = MyLang.ID
If MyLang.ID = My.Settings.St_Target_Language Then
Cb.SelectedItem(Cb.Items.Count) = True
End If
End If
Next
End Sub
However, I get the following error message:
Error BC30111 'Languages' is an interface type and cannot be used as an expression.
What can I do to rectify this and get it to work?
Any and all help would be much appreciated. Many thanks in advance.
Continue reading...
I am new at vb under studio and I am running into a problem that was easy to sort under VBA but puzzles me under Studio.
I am trying to create a VSTO Add-in for Word. I have a form which contains a combobox and I want to programmatically list the NameLocal (display value) and ID (value) of all languages of the system for which there is an ActiveSpelling Dictionary.
I locate this routine in the Form.Vb:
Private Sub PopulateMyLanguages()
Dim Cb As ComboBox = Me.Cbb_Languages
Dim MyLang As Microsoft.Office.Interop.Word.Language
For Each MyLang In Microsoft.Office.Interop.Word.Languages
If MyLang.ActiveSpellingDictionary.Path IsNot vbNullString Then
Cb.Items.Add(MyLang.NameLocal)
Cb.DisplayMember = MyLang.NameLocal
Cb.ValueMember = MyLang.ID
If MyLang.ID = My.Settings.St_Target_Language Then
Cb.SelectedItem(Cb.Items.Count) = True
End If
End If
Next
End Sub
However, I get the following error message:
Error BC30111 'Languages' is an interface type and cannot be used as an expression.
What can I do to rectify this and get it to work?
Any and all help would be much appreciated. Many thanks in advance.
Continue reading...