|
hi all
in my project i have a task with Ms word application
i have to open the already existing word document and
i have to pass the values to the bookmarks in that document
i written the following code
Dim wordapp As New Word.Application
wordapp = Nothing
wordapp = CreateObject("word.application")
Dim olddoc As Word.Document
olddoc = wordapp.Documents.Open(AppPath + "Designs\Gantry2.doc")
'book marks
For i As Integer = 0 To 48
With wordapp.ActiveDocument
.Bookmarks.Item("b" + i.ToString()).Range.Text = DG_GanDict.Item("b" + i.ToString())
End With
Next
wordapp.ActiveDocument.SaveAs("test.doc")
wordapp.Visible = True
the above code works in Ms office 2003
but the same code does not works or executes in ms office 2007
even though i added the refernce
when i run it in ms office 2007
i get Runtime.InteropServices.COMException
This file could not be found.
(C:\//Program%20Files/VCS/...)
and ErrorCode = -2146823114
that to it happens in c:\ drive only
when i copy and paste the application in other drive like D:\
it executes properly
can any one have a idea about this problem
and is there any common code which runs in ms office 2003 and 2007 versions
thanks in advance
vijay kumar d
|
|
|
|
|
One problem may be the use of CreateObject.
vijaylumar wrote: Dim wordapp As New Word.Application
wordapp = Nothing
wordapp = CreateObject("word.application")
You got an instance of the Word Application object already so why ditch it and attemt to recreate it in the old VB6 style?
As for 2003/2007 execution, I don't see any 2007 specific code here. Target the 2003 interop assemblies, make sure you include them in your deployment, and it will work fine against 2007 as well. In fact I just installed Office 2010 and the 2003 Interop Assemblies still work against 2010!
|
|
|
|
|
how can i bound textbox control for numeric value only
|
|
|
|
|
Stop double posting, it is rude
My advice is free, and you may get what you paid for.
|
|
|
|
|
You cant.
There is a reason it is called a TextBox, it is for text.
If you want the input to be treated as a number you have to put exceptions on to check that a number has been entered and then parse the resultant input to INT (or whatever).
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
|
|
|
|
|
Create you're own version of a textbox that only accept's number keys and those required for editing values.
No, i don't have "exact code" to give you. You're not the first person to try and do this. There are thousands of example of how to do this on the web.
|
|
|
|
|
|
THanks alot THE CODE PROJECT TEAM
|
|
|
|
|
Look, reply to the previous post. STOP CREATING NEW THREADS EVERY TIME YOU WANT TO RESPOND TO THE PREVIOUS POST!
The code that was given to you was "accurate" every time. It may have required a little tweaking to fit your code exactly, but that's what you get paid to do, correct? You know, write code...
|
|
|
|
|
Dave Kreskowiak wrote: but that's what you get paid to do, correct? You know, write code...
apparently not. He gets paid to spam boards under the impression that it's a dedicated team that will do all his work for him.
|
|
|
|
|
what do you mean? you're not dedicated??
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
i want msgbox if i press enter key on textbox control
|
|
|
|
|
You are unbelievable here;
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyCode = Keys.Enter Then
MsgBox(TextBox1.Text)
End If
End Sub
|
|
|
|
|
thats not working, that is why i m asking again n again
|
|
|
|
|
Do not keep re-asking the same thing, or people will get pi$$ed off.
Stick within the original thread and edit/respond as appropriate. Maybe you are not being clear with your question and thats why you are not getting the response you are expecting.
I understand that english is maybe not your first language, and putting technical queries from your native tongue to english is maybe not easy, but patience and maybe a little help from Google Translate is all that is required!
Cheers,
|
|
|
|
|
how to call msgbox in vb.net on enter key press event
|
|
|
|
|
What are you up to ??? This is the third time you've asked this, and it has been answered in two laguages. Stop reposting.
|
|
|
|
|
Are we taking bets for a quadruple posting of the same question?
|
|
|
|
|
I think it's up to six times now, although I think he's got the message now
|
|
|
|
|
Please try not to TRIPLE post your questions.............
|
|
|
|
|
how to call msgbox on key(enter) even on textbox control in VB.NET
|
|
|
|
|
Please, try not to double post.
My advice is free, and you may get what you paid for.
|
|
|
|
|
how to call msg box on Enter(key) press event in vb.net
|
|
|
|
|
use the below code
private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (char)(0x0D))
MessageBox.Show("Enter Pressed");
}
Thanks
Rajesh B --> A Poor Workman Blames His Tools <--
|
|
|
|
|
I assume you want it VB.Net not C#. Try this
Private Sub txtTest_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtTest.KeyDown
If e.KeyCode = Keys.Enter Then
MsgBox("You pressed the Enter Key")
End If
End Sub
Happy Coding
|
|
|
|