Click here to Skip to main content
15,884,629 members
Home / Discussions / C#
   

C#

 
GeneralRe: Custom MessageBox buttons Pin
Colin Angus Mackay3-Jan-04 6:51
Colin Angus Mackay3-Jan-04 6:51 
GeneralRe: Custom MessageBox buttons Pin
jconwell3-Jan-04 18:05
jconwell3-Jan-04 18:05 
GeneralUsing Word with C# Pin
Stephane David3-Jan-04 5:43
Stephane David3-Jan-04 5:43 
GeneralRe: Using Word with C# Pin
Heath Stewart3-Jan-04 8:03
protectorHeath Stewart3-Jan-04 8:03 
GeneralRe: Using Word with C# Pin
Stephane David3-Jan-04 9:58
Stephane David3-Jan-04 9:58 
GeneralRe: Using Word with C# Pin
Nick Parker3-Jan-04 10:05
protectorNick Parker3-Jan-04 10:05 
GeneralRe: Using Word with C# Pin
Stephane David3-Jan-04 10:16
Stephane David3-Jan-04 10:16 
GeneralRe: Using Word with C# Pin
Heath Stewart3-Jan-04 10:58
protectorHeath Stewart3-Jan-04 10:58 
Stephane David wrote:
I agree that user should never see an exception, but I think it is even better to write correct code and avoid the exception, rather than displaying the error message.

This is a bad assumption! Did you write Microsoft Word? I'm betting you didn't, so why trust the work of other people whom you probably don't know, and code in another application where a whole different set of problems exist? Never do. Never trust user input, and never trust another application. Always account for problems that might occur. Do you think that Word blindly accepts input from calling functions?

And just because a parameter takes a value of true doesn't mean that the converse is false. Look again at the type: Variant. When a variant isn't specified, it is an empty or missing variant, hence using Missing.Value (or sometimes you see
Type.Missing).<br />
<br />
I found this example on MSDN: <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_wrcore/html/wrtskhowtosearchfortextinworddocuments.asp">How to: search for text in Word documents</a>[<a target=_blank title='New Window' href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_wrcore/html/wrtskhowtosearchfortextinworddocuments.asp">^</a>]. They use <code>Type.Missing
to find text. You have the right values for the ReplaceWith and Replace parameters. Also, you can search over the whole document (since in the example they set the range to the first two paragraphs) by using Document.Content instead of Application.Selection.Range, which - if I remember correctly - is an empty range anyway. I don't know about that, though - it's been a while since I programmed with the Office libraries. In any case, Document.Content is a Range over the whole document, which seems to be what you wanted anyway. Good luck!

 

-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
GeneralRe: Using Word with C# Pin
Stephane David3-Jan-04 19:00
Stephane David3-Jan-04 19:00 
GeneralRe: Using Word with C# Pin
Heath Stewart3-Jan-04 19:02
protectorHeath Stewart3-Jan-04 19:02 
GeneralRe: Using Word with C# Pin
Stephane David3-Jan-04 19:40
Stephane David3-Jan-04 19:40 
GeneralRe: Using Word with C# Pin
Heath Stewart3-Jan-04 19:42
protectorHeath Stewart3-Jan-04 19:42 
GeneralRe: Using Word with C# Pin
Stephane David3-Jan-04 19:49
Stephane David3-Jan-04 19:49 
GeneralRe: Using Word with C# Pin
Stephane David8-Jan-04 11:04
Stephane David8-Jan-04 11:04 
GeneralDisabled toolbar images Pin
richjm3-Jan-04 2:47
richjm3-Jan-04 2:47 
GeneralRe: Disabled toolbar images Pin
Heath Stewart3-Jan-04 7:38
protectorHeath Stewart3-Jan-04 7:38 
Questionstart menu? Pin
warelord3-Jan-04 0:22
warelord3-Jan-04 0:22 
AnswerRe: start menu? Pin
leppie3-Jan-04 1:37
leppie3-Jan-04 1:37 
AnswerRe: start menu? Pin
Jan R Hansen3-Jan-04 1:37
Jan R Hansen3-Jan-04 1:37 
AnswerRe: start menu? Pin
Steve McLenithan3-Jan-04 6:50
Steve McLenithan3-Jan-04 6:50 
AnswerRe: start menu? Pin
Heath Stewart3-Jan-04 7:21
protectorHeath Stewart3-Jan-04 7:21 
GeneralSkins Pin
Agent 862-Jan-04 12:18
Agent 862-Jan-04 12:18 
GeneralRe: Skins Pin
Heath Stewart2-Jan-04 19:38
protectorHeath Stewart2-Jan-04 19:38 
GeneralRe: Skins Pin
Agent 862-Jan-04 20:06
Agent 862-Jan-04 20:06 
GeneralRe: Skins Pin
J. Dunlap2-Jan-04 20:34
J. Dunlap2-Jan-04 20:34 

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.