Click here to Skip to main content
15,891,375 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Restoring bac the server Pin
0x3c017-Mar-09 7:13
0x3c017-Mar-09 7:13 
QuestionChanging Audio Devices? Pin
SeeingBlue17-Mar-09 4:53
SeeingBlue17-Mar-09 4:53 
AnswerRe: Changing Audio Devices? Pin
dan!sh 17-Mar-09 5:14
professional dan!sh 17-Mar-09 5:14 
AnswerRe: Changing Audio Devices? Pin
Xmen Real 17-Mar-09 5:43
professional Xmen Real 17-Mar-09 5:43 
QuestionHow could you check a node in treeview whenever a child node gets checked? Pin
JUNEYT17-Mar-09 4:21
JUNEYT17-Mar-09 4:21 
AnswerRe: How could you check a node in treeview whenever a child node gets checked? Pin
Eddy Vluggen17-Mar-09 4:46
professionalEddy Vluggen17-Mar-09 4:46 
AnswerRe: How could you check a node in treeview whenever a child node gets checked? Pin
Xmen Real 17-Mar-09 6:29
professional Xmen Real 17-Mar-09 6:29 
QuestionWord.Application() not defined? Pin
Speedular17-Mar-09 4:00
Speedular17-Mar-09 4:00 
Hello all

I'm trying to include the a Grammer check into my app; one of the approaches that I've come across is using MS.Words' but it seem that I'm facing somedefficulties that I can't figure out;

mports System.Runtime.InteropServices

Public Class Form1
Inherits System.Windows.Forms.Form

' Invokes either the spell or grammar checker.
Private Sub SpellOrGrammarCheck(ByVal blnSpellOnly As Boolean)

Try
' Create Word and temporary document objects.
Dim objWord As Object
Dim objTempDoc As Object
' Declare an IDataObject to hold the data returned from the
' clipboard.
Dim iData As IDataObject

' If there is no data to spell check, then exit sub here.
If TextBox1.Text = "" Then
Exit Sub
End If

objWord = New Word.Application() // My problem is here as it shows that it is not defined
objTempDoc = objWord.Documents.Add
objWord.Visible = False

' Position Word off the screen...this keeps Word invisible
' throughout.
objWord.WindowState = 0
objWord.Top = -3000

' Copy the contents of the textbox to the clipboard
Clipboard.SetDataObject(TextBox1.Text)

' With the temporary document, perform either a spell check or a
' complete
' grammar check, based on user selection.
With objTempDoc
.Content.Paste()
.Activate()
If blnSpellOnly Then
.CheckSpelling()
Else
.CheckGrammar()
End If
' After user has made changes, use the clipboard to
' transfer the contents back to the text box
.Content.Copy()
iData = Clipboard.GetDataObject
If iData.GetDataPresent(DataFormats.Text) Then
TextBox1.Text = CType(iData.GetData(DataFormats.Text), _
String)
End If
.Saved = True
.Close()
End With

objWord.Quit()

MessageBox.Show("The spelling check is complete.", _
"Spell Checker", MessageBoxButtons.OK, _
MessageBoxIcon.Information)

' Microsoft Word must be installed.
Catch COMExcep As COMException
MessageBox.Show( _
"Microsoft Word must be installed for Spell/Grammar Check " _
& "to run.", "Spell Checker")

Catch Excep As Exception
MessageBox.Show("An error has occured.", "Spell Checker")

End Try

End Sub

Private Sub btnSpellCheck_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnSpellCheck.Click
SpellOrGrammarCheck(True)
End Sub

Private Sub btnGrammarCheck_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles btnGrammarCheck.Click
SpellOrGrammarCheck(False)
End Sub

End Class
>



any help? I've added the reference Microsoft Word 12.0 object but still has the same problem undefined ..!!!?
or if any has another idea; I will highly appreciate it...
cheers
AnswerRe: Word.Application() not defined? Pin
dan!sh 17-Mar-09 5:03
professional dan!sh 17-Mar-09 5:03 
GeneralRe: Word.Application() not defined? Pin
Speedular17-Mar-09 5:17
Speedular17-Mar-09 5:17 
GeneralRe: Word.Application() not defined? Pin
dan!sh 17-Mar-09 5:21
professional dan!sh 17-Mar-09 5:21 
GeneralRe: Word.Application() not defined? Pin
Speedular17-Mar-09 5:47
Speedular17-Mar-09 5:47 
QuestionHow to use Font Pin
Anubhava Dimri17-Mar-09 2:39
Anubhava Dimri17-Mar-09 2:39 
AnswerRe: How to use Font Pin
Dave Kreskowiak17-Mar-09 3:37
mveDave Kreskowiak17-Mar-09 3:37 
GeneralRe: How to use Font Pin
Jon_Boy17-Mar-09 6:06
Jon_Boy17-Mar-09 6:06 
QuestionListbox Pin
hendrikbez17-Mar-09 1:11
hendrikbez17-Mar-09 1:11 
AnswerRe: Listbox Pin
Eddy Vluggen17-Mar-09 1:43
professionalEddy Vluggen17-Mar-09 1:43 
GeneralRe: Listbox Pin
Luc Pattyn17-Mar-09 2:26
sitebuilderLuc Pattyn17-Mar-09 2:26 
GeneralRe: Listbox Pin
Eddy Vluggen17-Mar-09 3:17
professionalEddy Vluggen17-Mar-09 3:17 
GeneralRe: Listbox Pin
Chinners17-Mar-09 2:43
Chinners17-Mar-09 2:43 
GeneralRe: Listbox Pin
hendrikbez17-Mar-09 18:43
hendrikbez17-Mar-09 18:43 
QuestionPause application Pin
Jay Royall17-Mar-09 0:16
Jay Royall17-Mar-09 0:16 
AnswerRe: Pause application Pin
Colin Angus Mackay17-Mar-09 1:02
Colin Angus Mackay17-Mar-09 1:02 
AnswerRe: Pause application Pin
Eddy Vluggen17-Mar-09 1:06
professionalEddy Vluggen17-Mar-09 1:06 
GeneralRe: Pause application Pin
Colin Angus Mackay17-Mar-09 3:15
Colin Angus Mackay17-Mar-09 3:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.