Solved

COM access

Posted on 2004-08-19
1
147 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
Comment Utility

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now