Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: vba string problems

  1. #1
    New Member
    Join Date
    Apr 2002
    Location
    JimJ
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    When I run this subroutine:

    Sub test_macro()
    String1 = "Hello World"
    String2 = Right(String1, 3)

    End

    I get this compile error message:
    "Can't find project or library"
    It shows the line:
    String2 = Right(String1, 3)
    with "Right" in bold.

    I know this is something very simple but I'm unable to figure it out.

  2. #2
    Board Regular eliW's Avatar
    Join Date
    Mar 2002
    Posts
    1,919
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-04-03 12:49, excel_lint wrote:
    When I run this subroutine:

    Sub test_macro()
    String1 = "Hello World"
    String2 = Right(String1, 3)

    End

    I get this compile error message:
    "Can't find project or library"
    It shows the line:
    String2 = Right(String1, 3)
    with "Right" in bold.

    I know this is something very simple but I'm unable to figure it out.
    I've copied your macro to my worksheet and it works fine. Try to do the same in another workbook.
    End with 'End Sub'
    Eli

    [ This Message was edited by: eliW on 2002-04-03 14:36 ]

  3. #3
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi excel_lint

    While in the VBE go to Tools>Refrences the missing reference will be preceded with the word "Missing" use the browse button to locate and load it.



  4. #4
    New Member
    Join Date
    Apr 2002
    Location
    JimJ
    Posts
    4
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks, I opened a new worksheet and it worked fine. Don't know why it won't work in the orginal but this solution will get me going.
    --------------
    On 2002-04-03 14:35, eliW wrote:
    On 2002-04-03 12:49, excel_lint wrote:
    When I run this subroutine:

    Sub test_macro()
    String1 = "Hello World"
    String2 = Right(String1, 3)

    End

    I get this compile error message:
    "Can't find project or library"
    It shows the line:
    String2 = Right(String1, 3)
    with "Right" in bold.

    I know this is something very simple but I'm unable to figure it out.
    I've copied your macro to my worksheet and it works fine. Try to do the same in another workbook.
    End with 'End Sub'
    Eli

    [ This Message was edited by: eliW on 2002-04-03 14:36 ]
    [/quote]

  5. #5
    Board Regular
    Join Date
    Mar 2002
    Location
    Cincinnati, Ohio, USA
    Posts
    6,824
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    If you do not see a missing reference, change your code as follows:

    String2 = Right(String1, 3)
    String2 = Strings.Right(String1, 3)

    That should solve your problem

    Tom



Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •