473,397 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

updated word query

Hi,

Further to a reply I recieved earlier I tested what was
written and produced the following

Private Sub Button2_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Button2.Click

Dim appWord As New Word.Application
appWord.Visible = True 'Makes Word
visible
appWord.Documents.Add() 'Creates
New Blank Doc

Dim str As String = "Text"
Dim rng As Word.Range = appWord.Range(Start:=0, End:=0)

rng.Text = str
rng.Select=()
End Sub

the script itself will open word, however it wont paste and
throws out the following:

An unhandled exception of type
'System.MissingMemberException' occurred in
microsoft.visualbasic.dll

Additional information: Public member 'Range' on type
'ApplicationClass' not found.

I was wondering what it was likely I was doing wrong

Many thanks for any help

Vicky
(Learning fast, but not fast enough)
Nov 20 '05 #1
2 1232
You need to specify the range on the current document, not the application.
Like this:

Dim theDocument As Word.Document

theDocument = appWord.Documents.Add()

Dim str As String = "Text"
Dim rng As Word.Range = theDocument .Range(Start:=0, End:=0)

rng.Text = str
rng.Select=()

"Vicky" <an*******@discussions.microsoft.com> wrote in message
news:23*****************************@phx.gbl...
Hi,

Further to a reply I recieved earlier I tested what was
written and produced the following

Private Sub Button2_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Button2.Click

Dim appWord As New Word.Application
appWord.Visible = True 'Makes Word
visible
appWord.Documents.Add() 'Creates
New Blank Doc

Dim str As String = "Text"
Dim rng As Word.Range = appWord.Range(Start:=0, End:=0)

rng.Text = str
rng.Select=()
End Sub

the script itself will open word, however it wont paste and
throws out the following:

An unhandled exception of type
'System.MissingMemberException' occurred in
microsoft.visualbasic.dll

Additional information: Public member 'Range' on type
'ApplicationClass' not found.

I was wondering what it was likely I was doing wrong

Many thanks for any help

Vicky
(Learning fast, but not fast enough)

Nov 20 '05 #2
Hi robin,

thankyou

vicky
-----Original Message-----
You need to specify the range on the current document, not the application.Like this:

Dim theDocument As Word.Document

theDocument = appWord.Documents.Add()

Dim str As String = "Text"
Dim rng As Word.Range = theDocument .Range(Start:=0, End:=0)

rng.Text = str
rng.Select=()

"Vicky" <an*******@discussions.microsoft.com> wrote in message
news:23*****************************@phx.gbl...
Hi,

Further to a reply I recieved earlier I tested what was
written and produced the following

Private Sub Button2_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
Button2.Click

Dim appWord As New Word.Application
appWord.Visible = True 'Makes Word
visible
appWord.Documents.Add() 'Creates
New Blank Doc

Dim str As String = "Text"
Dim rng As Word.Range = appWord.Range(Start:=0, End:=0)
rng.Text = str
rng.Select=()
End Sub

the script itself will open word, however it wont paste and
throws out the following:

An unhandled exception of type
'System.MissingMemberException' occurred in
microsoft.visualbasic.dll

Additional information: Public member 'Range' on type
'ApplicationClass' not found.

I was wondering what it was likely I was doing wrong

Many thanks for any help

Vicky
(Learning fast, but not fast enough)

.

Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Ben Schminke | last post by:
I have seen this "field cannot be updated" error on several FAQ's, and but none of the solutions seem to match my situation. I have a form based on a query. When I try to add a new record, this...
3
by: Lynn A. | last post by:
Access/Word 2000 I am trying to merge a word document with an access query that has a parameter attached to it. Could someone please suggest how to stop the parameter from appearing when the...
8
by: Mike MacSween | last post by:
tblCourses one to many to tblEvents. A course may have an intro workshop (a type of event), a mid course workshop, a final exam. Or any combination. Or something different in the future. At...
12
by: Jim Hammond | last post by:
I am passing the whole object instead or parameters in my select and update methods. I can get the updated object if I set UpdateMethod, let ASP.NET autogenerate an update button, and then press...
10
by: John | last post by:
Hi I am trying to do a word mailmerge form within my vb.net app. My problem is how to do a query on one of my tables and use the result as the mail merge datasource. Any help would be...
2
by: roz | last post by:
Hello, I'm fairly new to VB programming and I've been going round the bend with this problem, so any nudges or shoves in the right direction would be greatly appreciated. I have a template...
5
by: cdtsly | last post by:
Hi i have a table with all value at 4 i select all lines in a fetch i update one with a value of 7 i update all the row in the fetch with a value 5 the result is that all my row are at 5 and...
8
by: Keith | last post by:
I try to learn SQL by figuring out things. I want to make a listing of all records that were changed in the last... 1, 6, 12 hours/days. I have a field called 'updated' managed like: UPDATE...
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.