Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / June 2005

Tip: Looking for answers? Try searching our database.

replacing values using variable name

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Daniel - 13 Jun 2005 21:07 GMT
I am having trouble with using string variable name instead of "hello"
replacement.text. I am getting type mismatch when I pass it from htm file to
ocx. Any help would be appreciated.

Thanks
Daniel

With Selection.Find
   .ClearFormatting
   .Text = "hi"
   .Replacement.ClearFormatting
   .Replacement.Text = "hello"
   .Execute Replace:=wdReplaceAll, Forward:=True, Wrap:=wdFindContinue
End With
Jezebel - 14 Jun 2005 11:53 GMT
Dim pString as string

pString = "Goodbye"

With Selection.Find
 .ClearFormatting
 .Text = "hi"
  .Replacement.ClearFormatting
  .Replacement.Text = pString
  .Execute Replace:=wdReplaceAll, Forward:=True, Wrap:=wdFindContinue
End With

>I am having trouble with using string variable name instead of "hello"
> replacement.text. I am getting type mismatch when I pass it from htm file
[quoted text clipped - 11 lines]
>    .Execute Replace:=wdReplaceAll, Forward:=True, Wrap:=wdFindContinue
> End With
Daniel - 14 Jun 2005 13:38 GMT
That is what I did. And somehow I was getting type mismatch error. I changed
to ByVal rString As String, then the message disappeared. But somehow, the
text is not replaced. It finds and highlights it, but does not replace. I am
not sure why.

Thanks
Daniel

> Dim pString as string
>
[quoted text clipped - 23 lines]
> >    .Execute Replace:=wdReplaceAll, Forward:=True, Wrap:=wdFindContinue
> > End With

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.