Error 2023

Discussion in 'Excel Beginners' started by KarateB, Apr 17, 2014.

  1. KarateB

    KarateB Guest

    Ok new user here so be gentle :)

    Long story short, Im working with a excel database for a karate studi
    that was designed by someone who is no longer with us. I am trying t
    run an action that creates and prints labels and when i do I get a ru
    time error. The following is what shows up when i debug. If more info i
    needed let me know, this database contains some sensitive info so I'
    trying to be careful of what I post.

    x.Selection.TypeParagraph

    ' Change font back so it is not red for rest of label
    x.Selection.Font.ColorIndex = wdBlack
    x.Selection.Font.Name = "Courier New"

    '*
    '* Format Phone Info
    '*
    x.Selection.Font.Bold = wdToggle
    x.Selection.TypeText Text:="Phones: "
    x.Selection.Font.Bold = wdToggle
    If (DadCellPhone <> "") And (MomCellPhone <> "") Then
    x.Selection.TypeText Text:=Left("Mc-" & MomCellPhone &
    Dc-" & DadCellPhone, 33)

    ElseIf (DadCellPhone = "") And (MomCellPhone <> "") Then
    x.Selection.TypeText Text:=Left("Mc-" & MomCellPhone &
    H-" & Homephone, 33)

    ElseIf (DadCellPhone <> "") And (MomCellPhone = "") Then
    x.Selection.TypeText Text:=Left("Dc-" & DadCellPhone &
    H-" & Homephone, 33)

    ElseIf (DadCellPhone = "") And (MomCellPhone = "") An
    (DadWorkphone <> "") Then
    x.Selection.TypeText Text:=Left("H-" & Homephone & " Dw-
    & DadWorkphone, 33)

    ElseIf (DadCellPhone = "") And (MomCellPhone = "") An
    (MomWorkPhone <> "") Then
    x.Selection.TypeText Text:=Left("H-" & Homephone & " Mw-
    & MomWorkPhone, 33)

    End If


    The line " If (DadCellPhone <> "") And (MomCellPhone <> "") Then
    x.Selection.TypeText Text:=Left("Mc-" & MomCellPhone &
    Dc-" & DadCellPhone, 33)" is highlighted yellow and gives a refrenc
    error but Im not sure how to go about fixing it. Any help is greatl
    appreciated. If you need more info please let me know. Thanks agai
    everyone
     
    KarateB, Apr 17, 2014
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.