EDN Admin
Well-known member
Hi ALL,<br/>
Firstly please see this thread.>>
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/f5bc3abd-0119-4d7d-8871-543895da24f7
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/f5bc3abd-0119-4d7d-8871-543895da24f7 <span style="text-decoration:underline http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/f5bc3abd-0119-4d7d-8871-543895da24f7
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/f5bc3abd-0119-4d7d-8871-543895da24f7 In the code in that thread the code calls on MS Word to check its dictionary
and then report back TRUE / FALSE if the word is found or not.
Rewriting the code slightly for a Windows Form application with <span style="text-decoration:underline
one Button on the Form I now have.>>
<pre class="prettyprint lang-vb Option Strict On
Option Explicit On
Option Infer Off
Imports Microsoft.Office.Interop
Imports System.IO
Imports System.Reflection
Imports System.Runtime.CompilerServices
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
app = New Word.Application
Dim Test1 As String = "color"
Dim Test2 As String = "asdfasdfasdf"
Dim Test3 As String = "colour"
MessageBox.Show(String.Format("{0} is {1} in UK Word Dictionary", Test1, Test1.IsInWordDictionary()))
MessageBox.Show(String.Format("{0} is {1} in USA Word Dictionary", Test1, Test1.IsInWordDictionary(Word.WdLanguageID.wdEnglishUS)))
MessageBox.Show(String.Format("{0} is {1} in UK Word Dictionary", Test3, Test3.IsInWordDictionary()))
MessageBox.Show(String.Format("{0} is {1} in USA Word Dictionary", Test3, Test3.IsInWordDictionary(Word.WdLanguageID.wdEnglishUS)))
app.Quit(False)
End Sub
End Class
Module Module1
Public app As Word.Application
<Extension()> _
Public Function IsInWordDictionary(ByVal s As String, Optional ByVal LangId As Word.WdLanguageID = Word.WdLanguageID.wdEnglishUK) As Boolean
Dim template As Object = Missing.Value
Dim newTemplate As Object = Missing.Value
Dim documentType As Object = Missing.Value
Dim visible As Object = False
Dim doc1 As Word._Document = app.Documents.Add(template, newTemplate, documentType, visible)
doc1.Content.LanguageID = LangId
doc1.Words.First.InsertBefore(s)
Return doc1.SpellingErrors.Count.Equals(0)
End Function
End Module[/code]
<br/>
Now to my <span style="text-decoration:underline main question .>>
How can we make an app in such a manner that I can call it in the same way MS Word is called above?
I realise I may need to set COM visible to TRUE in settings. Is there more to it than that?
Please provide a simple example or post some relative link(s).
Thank you in advance to all those who answer.
<
<
<
<h5>Regards,<br/>
<br/>
http://stackoverflow.com/users/895788/john-anthony-oliver <img alt="profile for John Anthony Oliver at Stack Overflow, Q&A for professional and enthusiast programmers" height="58" src="http://stackoverflow.com/users/flair/895788.png" title="profile for John Anthony Oliver at Stack Overflow, Q&A for professional and enthusiast programmers" width="208 </h5>
<
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/b15c28f5-1f7a-4053-97fc-2ece42e2f58d " target="blank Click this link to see the NEW way of how to insert a picture into a forum post.
<br/>
<br/>
http://www.fortypoundhead.com/showcontent.asp?artid=20502 " target="blank Installing VB6 on Windows 7
<br/>
<br/>
http://create.msdn.com/en-us/home/getting_started " target="blank App Hub for Windows Phone & XBOX 360 developers.
<
<br/>
View the full article
Firstly please see this thread.>>
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/f5bc3abd-0119-4d7d-8871-543895da24f7
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/f5bc3abd-0119-4d7d-8871-543895da24f7 <span style="text-decoration:underline http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/f5bc3abd-0119-4d7d-8871-543895da24f7
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/f5bc3abd-0119-4d7d-8871-543895da24f7 In the code in that thread the code calls on MS Word to check its dictionary
and then report back TRUE / FALSE if the word is found or not.
Rewriting the code slightly for a Windows Form application with <span style="text-decoration:underline
one Button on the Form I now have.>>
<pre class="prettyprint lang-vb Option Strict On
Option Explicit On
Option Infer Off
Imports Microsoft.Office.Interop
Imports System.IO
Imports System.Reflection
Imports System.Runtime.CompilerServices
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
app = New Word.Application
Dim Test1 As String = "color"
Dim Test2 As String = "asdfasdfasdf"
Dim Test3 As String = "colour"
MessageBox.Show(String.Format("{0} is {1} in UK Word Dictionary", Test1, Test1.IsInWordDictionary()))
MessageBox.Show(String.Format("{0} is {1} in USA Word Dictionary", Test1, Test1.IsInWordDictionary(Word.WdLanguageID.wdEnglishUS)))
MessageBox.Show(String.Format("{0} is {1} in UK Word Dictionary", Test3, Test3.IsInWordDictionary()))
MessageBox.Show(String.Format("{0} is {1} in USA Word Dictionary", Test3, Test3.IsInWordDictionary(Word.WdLanguageID.wdEnglishUS)))
app.Quit(False)
End Sub
End Class
Module Module1
Public app As Word.Application
<Extension()> _
Public Function IsInWordDictionary(ByVal s As String, Optional ByVal LangId As Word.WdLanguageID = Word.WdLanguageID.wdEnglishUK) As Boolean
Dim template As Object = Missing.Value
Dim newTemplate As Object = Missing.Value
Dim documentType As Object = Missing.Value
Dim visible As Object = False
Dim doc1 As Word._Document = app.Documents.Add(template, newTemplate, documentType, visible)
doc1.Content.LanguageID = LangId
doc1.Words.First.InsertBefore(s)
Return doc1.SpellingErrors.Count.Equals(0)
End Function
End Module[/code]
<br/>
Now to my <span style="text-decoration:underline main question .>>
How can we make an app in such a manner that I can call it in the same way MS Word is called above?
I realise I may need to set COM visible to TRUE in settings. Is there more to it than that?
Please provide a simple example or post some relative link(s).
Thank you in advance to all those who answer.

<
<
<
<h5>Regards,<br/>
<br/>
http://stackoverflow.com/users/895788/john-anthony-oliver <img alt="profile for John Anthony Oliver at Stack Overflow, Q&A for professional and enthusiast programmers" height="58" src="http://stackoverflow.com/users/flair/895788.png" title="profile for John Anthony Oliver at Stack Overflow, Q&A for professional and enthusiast programmers" width="208 </h5>
<
http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/b15c28f5-1f7a-4053-97fc-2ece42e2f58d " target="blank Click this link to see the NEW way of how to insert a picture into a forum post.
<br/>
<br/>
http://www.fortypoundhead.com/showcontent.asp?artid=20502 " target="blank Installing VB6 on Windows 7
<br/>
<br/>
http://create.msdn.com/en-us/home/getting_started " target="blank App Hub for Windows Phone & XBOX 360 developers.
<
<br/>
View the full article