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
Solved

COM access

Posted on 2004-08-19
1
150 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
1 Comment
 
LVL 3

Accepted Solution

by:
realrael earned 500 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

789 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