473,473 Members | 1,854 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Word / Bookmark

Hi
How can I set the text for a bookmark in my worddocument?
If I use the Range object I always get an error.
tnx
stefan
Nov 15 '05 #1
8 3474
Do we have to consider this a C# question?
I'm sure you will get better answers when posting to : microsoft.public.office.developper.automation
Willy.

"Stefan" <sh****@steffsworld.ch> wrote in message news:ej**************@TK2MSFTNGP12.phx.gbl...
Hi
How can I set the text for a bookmark in my worddocument?
If I use the Range object I always get an error.
tnx
stefan

Nov 15 '05 #2
Yes it's a c# question because i'm trying to fill up the bookmarks form a c#
application
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:Oh**************@TK2MSFTNGP12.phx.gbl...
Do we have to consider this a C# question?
I'm sure you will get better answers when posting to : microsoft.public.office.developper.automation Willy.

"Stefan" <sh****@steffsworld.ch> wrote in message

news:ej**************@TK2MSFTNGP12.phx.gbl...
Hi
How can I set the text for a bookmark in my worddocument?
If I use the Range object I always get an error.
tnx
stefan


Nov 15 '05 #3
NO it's not a C# language question you question/problem is not C# related , at best it's a interop question, so post to the
microsoft.public.dotnet.framework.interop.
And, If you want us to help you, you will need to be more explicit (add some code snippets, error messages ...).
Willy.
"Stefan" <sh****@steffsworld.ch> wrote in message news:ee**************@TK2MSFTNGP12.phx.gbl...
Yes it's a c# question because i'm trying to fill up the bookmarks form a c#
application
"Willy Denoyette [MVP]" <wi*************@pandora.be> wrote in message
news:Oh**************@TK2MSFTNGP12.phx.gbl...
Do we have to consider this a C# question?
I'm sure you will get better answers when posting to :

microsoft.public.office.developper.automation
Willy.

"Stefan" <sh****@steffsworld.ch> wrote in message

news:ej**************@TK2MSFTNGP12.phx.gbl...
Hi
How can I set the text for a bookmark in my worddocument?
If I use the Range object I always get an error.
tnx
stefan



Nov 15 '05 #4
Stefan,

You can not just set the Range property like this

// Trying to set the text like this fails.
Bookmarks[1].Range = "Text";

The reason for this is that in VB, you are actually setting the default
property on the Range object, which is Text (I believe). So, in your case,
you have to access the property manually, like this:

// You need to set the property explicitly.
Bookmarks[1].Range.Text = "Text";

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Stefan" <sh****@steffsworld.ch> wrote in message
news:ej**************@TK2MSFTNGP12.phx.gbl...
Hi
How can I set the text for a bookmark in my worddocument?
If I use the Range object I always get an error.
tnx
stefan

Nov 15 '05 #5
tnx a lot!
do you also know how i can call a sub from c#?
"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote
in message news:eS**************@TK2MSFTNGP12.phx.gbl...
Stefan,

You can not just set the Range property like this

// Trying to set the text like this fails.
Bookmarks[1].Range = "Text";

The reason for this is that in VB, you are actually setting the default property on the Range object, which is Text (I believe). So, in your case, you have to access the property manually, like this:

// You need to set the property explicitly.
Bookmarks[1].Range.Text = "Text";

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Stefan" <sh****@steffsworld.ch> wrote in message
news:ej**************@TK2MSFTNGP12.phx.gbl...
Hi
How can I set the text for a bookmark in my worddocument?
If I use the Range object I always get an error.
tnx
stefan


Nov 15 '05 #6
Stefan,

What do you mean by a sub?
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Stefan" <sh****@steffsworld.ch> wrote in message
news:uf**************@TK2MSFTNGP12.phx.gbl...
tnx a lot!
do you also know how i can call a sub from c#?
"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote in message news:eS**************@TK2MSFTNGP12.phx.gbl...
Stefan,

You can not just set the Range property like this

// Trying to set the text like this fails.
Bookmarks[1].Range = "Text";

The reason for this is that in VB, you are actually setting the

default
property on the Range object, which is Text (I believe). So, in your

case,
you have to access the property manually, like this:

// You need to set the property explicitly.
Bookmarks[1].Range.Text = "Text";

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Stefan" <sh****@steffsworld.ch> wrote in message
news:ej**************@TK2MSFTNGP12.phx.gbl...
Hi
How can I set the text for a bookmark in my worddocument?
If I use the Range object I always get an error.
tnx
stefan



Nov 15 '05 #7
i have a sub in the word document
Public Sub FillUpTemplate()
'Do something
End Sub
"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote
in message news:es*************@TK2MSFTNGP11.phx.gbl...
Stefan,

What do you mean by a sub?
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Stefan" <sh****@steffsworld.ch> wrote in message
news:uf**************@TK2MSFTNGP12.phx.gbl...
tnx a lot!
do you also know how i can call a sub from c#?
"Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com>

wrote
in message news:eS**************@TK2MSFTNGP12.phx.gbl...
Stefan,

You can not just set the Range property like this

// Trying to set the text like this fails.
Bookmarks[1].Range = "Text";

The reason for this is that in VB, you are actually setting the

default
property on the Range object, which is Text (I believe). So, in your

case,
you have to access the property manually, like this:

// You need to set the property explicitly.
Bookmarks[1].Range.Text = "Text";

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Stefan" <sh****@steffsworld.ch> wrote in message
news:ej**************@TK2MSFTNGP12.phx.gbl...
> Hi
> How can I set the text for a bookmark in my worddocument?
> If I use the Range object I always get an error.
> tnx
> stefan
>
>



Nov 15 '05 #8
The replacement for a sub is a void so in c# it would be

public void mySub()

{

//so something

}

Just call it be typing mySub if it's in the same class...

"Stefan" <sh****@steffsworld.ch> wrote in message
news:uf**************@TK2MSFTNGP12.phx.gbl...
| tnx a lot!
| do you also know how i can call a sub from c#?
| "Nicholas Paldino [.NET/C# MVP]" <ni**************@exisconsulting.com> wrote
| in message news:eS**************@TK2MSFTNGP12.phx.gbl...
| > Stefan,
| >
| > You can not just set the Range property like this
| >
| > // Trying to set the text like this fails.
| > Bookmarks[1].Range = "Text";
| >
| > The reason for this is that in VB, you are actually setting the
| default
| > property on the Range object, which is Text (I believe). So, in your
| case,
| > you have to access the property manually, like this:
| >
| > // You need to set the property explicitly.
| > Bookmarks[1].Range.Text = "Text";
| >
| > Hope this helps.
| >
| >
| > --
| > - Nicholas Paldino [.NET/C# MVP]
| > - ni**************@exisconsulting.com
| >
| > "Stefan" <sh****@steffsworld.ch> wrote in message
| > news:ej**************@TK2MSFTNGP12.phx.gbl...
| > > Hi
| > > How can I set the text for a bookmark in my worddocument?
| > > If I use the Range object I always get an error.
| > > tnx
| > > stefan
| > >
| > >
| >
| >
|
|
Nov 15 '05 #9

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

Similar topics

0
by: ingvald | last post by:
hi, i've hit a wall regarding php and ms word. what i want is to open a document containing bookmarks, insert text where the bookmarks are, and save. it's working, unless the bookmark is in...
6
by: Ryan Muller | last post by:
My company just upgraded from Access 97 to Access 2003 today and we are having some issues in a database that generates a Word document from information selected in a form. Here is the code we...
1
by: adam lital | last post by:
Hi, I have word document and i want to replace a specific text with a bookmark using code. Example: in the document i have the text and i want to replace this to a bookmark called ClientName....
0
by: Raj Singh | last post by:
I am facing a problem with Visual C# 2003 and MS Word XP. I am using a customized template for Word and in that template I have defined some bookmarks. I am trying to create a Word document based...
2
by: fordesky | last post by:
Gday, I have a set of Access 2000 tables that I would like to export into a MS Word 2000 template at specific bookmark locations that I've set up. Would anyone know the code to achieve...
1
by: jpr | last post by:
Hello friends, I have a good question for you. I have a form in Access with a check box named chk1. On the same form I have a code that export my data to a template in MS Word. I use bookmark to...
1
by: bluestar | last post by:
hello i am trying to develope an application for word automation.i need to insert header and footer to the document. i found an exampke in msdn and used it in my application.it works well;but...
2
by: Mike Fellows | last post by:
Hi, I am trying to parse a word document to get a list of all the bookmarks that are setup within the document I need to be able to parse the bookmarks though without knowing the bookmark...
2
by: Alan T | last post by:
How do I make use of the Bookmarks property so that I can write a text at/below the position of a particular bookmark or the first bookmark ? private Microsoft.Office.Interop.Word.Document...
0
by: Alan T | last post by:
My code can select the content of a Word document between 2 bookmarks: if (bookmarks.Exists("first bookmark") & bookmarks.Exists("second bookmark")) { object oFirstBookmark = ("first...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.