473,320 Members | 1,694 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,320 software developers and data experts.

XP PIAS

I need to create a method that finds a word and replace it for another. I
add at the end of this post the code. My problem is that every time I try to
run it, it gives me an error either stack over flow or "stub" something. The
error ocurr only when I try to acces the Replacement property. Most of my
code is from a person who told me that this code was running in his
computer.

Is it right? What do I need to make run?

Please help!

private void button1_Click(object sender, System.EventArgs e)

{

object readOnly = false;

object isVisible = true;

object missingValue = Type.Missing;

object replaceAll = Microsoft.Office.Interop.Word.WdReplace.wdReplaceA ll;

string currentDate = DateTime.Now.ToString();

object fileName = @"C:\A Document.doc";

object falseCond = false;

object empty = "";

object nullObj = null;

object objFormat =
Microsoft.Office.Interop.Word.WdOpenFormat.wdOpenF ormatAuto;

Microsoft.Office.Interop.Word.ApplicationClass wordApp = new
Microsoft.Office.Interop.Word.ApplicationClass();

wordApp.Visible = true;
Microsoft.Office.Interop.Word.Document myDoc = wordApp.Documents.Open(ref
fileName,

ref missingValue, ref readOnly, ref missingValue, ref missingValue,

ref missingValue, ref missingValue, ref missingValue, ref missingValue,

ref missingValue, ref missingValue, ref isVisible, ref missingValue,

ref missingValue, ref missingValue);
try

{
wordApp.Application.Selection.Find.ClearFormatting ();

// Full name search/replace

myDoc.Application.Selection.Find.Text = "Historia";

myDoc.Application.Selection.Find.Replacement.Text = "Futuro";

myDoc.Application.Selection.Find.Execute(ref missingValue,

ref missingValue, ref missingValue, ref missingValue,

ref missingValue, ref missingValue, ref missingValue,

ref missingValue, ref missingValue, ref missingValue,

ref replaceAll, ref missingValue, ref missingValue,

ref missingValue, ref missingValue);
}

catch(Exception ex)

{

MessageBox.Show(ex.Message );

}
}

}
Nov 22 '05 #1
0 808

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

Similar topics

0
by: dalorzo | last post by:
I need to create a method that finds a word and replace it for another. I add at the end of this post the code. My problem is that every time I try to run it, it gives me an error either stack over...
1
by: zfeld | last post by:
1. Where do I get the Office 2003 PIAs? On the MSDN download site there are only downloads for XP office PIAs. Do they automatically get installed to the GAC with the installation of office 2003? ...
4
by: Bob | last post by:
Hi, I am using Office XP PIAs. I want to use Word/Excel to printOut documents w/o bringing up the application at all. When I set the Visible field to false, I still get the printing window...
17
by: Mansi | last post by:
I need to do some research on how to use excel automation from c#. Does anyone know of any good books related to this subject? Thanks. Mansi
4
by: J-T | last post by:
I'm trying to read an excell file in my .Net application using Office XP Primary Interop Assemblies (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/odc_oxppias.asp)....
1
by: murl | last post by:
Is it just me or is there no easy way to open an excel file, and get the column names that are usually in the 1st row? I would like to be able to do this for a import tool im writing in vb.net and...
2
by: Gerhard | last post by:
I would like to integrate Outlook into my vb.net web page, so that when I send an email (which I can successfully do now), it shows up in the sender's Outlook Sent Items. How do I do that? ...
0
by: LeAnne | last post by:
I've developed a word Add-in. I need to support Office XP and Office 2003. I've learnt that if using Office XP, then my product needs to be using the XP PIAs and vice versa. Thus at the end...
2
by: James | last post by:
I am doing some Excel 2000 automaton using Vb 2005. I am referencing the Excel 9.0 COM Object Library. The following code was working fine: Dim xlApp as new Excel.Application Dim xlWb as...
2
by: Brad Isaac | last post by:
Hi, I have a working app that uses interop.outlook.dll to export items to Outlook calendar. I downloaded the Primary Interop Assemblies for Office 2k7 today and still cannot get a working...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.