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
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

excel macro

  • 26-05-2005 11:17am
    #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