Solved

COM access

Posted on 2004-08-19
1
149 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

U.S. Department of Agriculture and Acronis Access

With the new era of mobile computing, smartphones and tablets, wireless communications and cloud services, the USDA sought to take advantage of a mobilized workforce and the blurring lines between personal and corporate computing resources.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
vb.net 2 43
Want to create a userform that looks like the image provided 10 63
Ajax Panel Not Updating When Triggered By Timer 4 72
Close form "before" open 3 40
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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

770 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