Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

excel macro

Options
  • 26-05-2005 12:17pm
    #1
    Closed Accounts Posts: 202 ✭✭


    ok, I got this problem were I have to open a word doc from excel, find a word in the doc, and then replace it with another word(I can do these). the problem is that when I replace the word I have to change the font to Wingdings.

    I've tried just putting the line "selection.font.name = 'Wingdings'" into the find and replace sub but it doesn't work.

    I'm thinking I'm just putting it in the wrong place or something

    here's my code for the find and replace sub:

    Sub FindRep2(target As String, source As String)

    wordApp.Selection.Find.ClearFormatting
    wordApp.Selection.Find.Replacement.ClearFormatting
    wordApp.Selection.Find.Replacement.Font.Name = "Wingdings"
    With wordApp.Selection.Find
    .Text = target
    .Replacement.Text = source
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False

    .Execute Replace:=wdReplaceAll
    End With



    thanks

    Rob


Comments

  • Closed Accounts Posts: 35 Ivan Dunaev


    try .Format = True instead of .Format = False


  • Closed Accounts Posts: 202 ✭✭eyebrows


    OMG. I was tyring to get that working for ages and it was this fecken thing
    try .Format = True instead of .Format = False

    fúcking me up the whole time.

    cheers Ivan


Advertisement