[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

COM access

Posted on 2004-08-19
1
Medium Priority
?
156 Views
Last Modified: 2010-04-23
I was just wondering for VB.net what I have to declare a function as to let outside applications use it. Right now, this is my function:

        Sub SearchReplace()
            ThisApplication.Documents.Open("C:\reminder.doc")
            With ThisApplication.Selection.Find
                .ClearFormatting()
                .Text = search_text
                With .Replacement
                    .ClearFormatting()
                    .Text = replace_text
                End With
                .Execute(Replace:=MyINTERP.WdReplace.wdReplaceAll)
            End With
        End Sub

Just basically is a search and replace function. I have the following to set the actual variables:

        Public Property searchText()
            Get
                Return search_text
            End Get
            Set(ByVal Value)
                search_text = Value
            End Set
        End Property
        Public Property replaceText()
            Get
                Return replace_text
            End Get
            Set(ByVal Value)
                replace_text = Value
            End Set
        End Property

Now, I can set the search_text and replace_text variables prefectly via COM, but when I try to do this:

myobj.SearchReplace();

It throws a nasty error my way. Should I be declaring it something other than a Subroutine?
0
Comment
Question by:drakkarnoir
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 3

Accepted Solution

by:
realrael earned 2000 total points
ID: 11849124

try making your sub public:

Public Sub SearchReplace()

here's some reference: http://support.microsoft.com/default.aspx?scid=kb;en-us;307210&Product=vbNET#6

let me know how it goes.

- rael
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question