+ Reply to Thread
Results 1 to 13 of 13

Changing labels caption gives error

  1. #1
    Registered User
    Join Date
    01-14-2009
    Location
    Portugal
    MS-Off Ver
    Excel 2007
    Posts
    29

    Changing labels caption gives error

    Hello,

    I have this code:

    Sheets("Tabelas").Visible = True
    Sheets("Tabelas").Select
    nome1.Caption = Cells(4, 1).Value
    Item1.Caption = Cells(4, 1).Value
    Where nome1 and Item1 are labels.
    After we run the code, the excel aborts when it executes the line
    Item1.Caption = Cells(4, 1).Value
    I don't have any idea why this happens.
    The only thing I know is that I open the file in my computer and save it, I open it in another computer and it will give the error like I told you before.
    Can anyone help me how can I resolve the problem, or what I should do to investigate it?

    Thanks in advance.

    Mário

  2. #2
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Changing labels caption gives error

    Where are the labels?
    Good luck.

  3. #3
    Registered User
    Join Date
    01-14-2009
    Location
    Portugal
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Changing labels caption gives error

    Quote Originally Posted by OnErrorGoto0 View Post
    Where are the labels?
    Hello,

    I have a form, inside the form I have a a multipage panel, inside of it I have a frame and the label is inside that frame.

    Thank you.

    Mário

  4. #4
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Changing labels caption gives error

    What error does it give, and what is in the cell referred to? (is it an error value?)

  5. #5
    Registered User
    Join Date
    01-14-2009
    Location
    Portugal
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Changing labels caption gives error

    Quote Originally Posted by OnErrorGoto0 View Post
    What error does it give, and what is in the cell referred to? (is it an error value?)
    No, the value of the cell is a text value, this case is a name like "Mario", I put a msgbox before and it gives me "Mario", but when it assign the value to the Item1.caption it freezes the Excel.
    Tomorrow I can tell you what is the exactly error, but it's something like "Unexpected error and excel is trying to correct it", and then excel re-starts and the file appears like it's being recovered.
    Thanks,
    Mário

  6. #6
    Registered User
    Join Date
    01-14-2009
    Location
    Portugal
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Changing labels caption gives error

    Quote Originally Posted by OnErrorGoto0 View Post
    What error does it give, and what is in the cell referred to? (is it an error value?)
    Because the cell value has special characters, like "João" "José" I don't know this could cause the error. You have any idea this could be a problem?

  7. #7
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Changing labels caption gives error

    It is possible I think. I had a similar thread in another forum a year or so ago using symbols in a list view on a form. Worked fine for some people but regularly bombed for the poster. Easy enough to test by replacing the text with something else. Also try a Unicode font for the label? (I'm on a phone now so can't test)

  8. #8
    Registered User
    Join Date
    01-14-2009
    Location
    Portugal
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Changing labels caption gives error

    Quote Originally Posted by OnErrorGoto0 View Post
    It is possible I think. I had a similar thread in another forum a year or so ago using symbols in a list view on a form. Worked fine for some people but regularly bombed for the poster. Easy enough to test by replacing the text with something else. Also try a Unicode font for the label? (I'm on a phone now so can't test)
    Hello again,

    Sorry for not answer you yesterday, but only I'm in my workplace and with conditions to test the file again.
    I took out the special characters and the labels have the Times New Roman font. I opened it in my PC it's ok, in the other PC crashed again... ((((.
    I don't know what to do more.
    Have you any idea?

    Thanks,
    Mário

  9. #9
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Changing labels caption gives error

    Can you set the caption to a literal string rather then a cell value on the other pc?
    Please Login or Register  to view this content.
    for example?

  10. #10
    Registered User
    Join Date
    01-14-2009
    Location
    Portugal
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Changing labels caption gives error

    Quote Originally Posted by OnErrorGoto0 View Post
    Can you set the caption to a literal string rather then a cell value on the other pc?
    Please Login or Register  to view this content.
    for example?
    I try it now and the effect is the same. It crashed!! (

    Please Login or Register  to view this content.
    After the "Here" message it crashes the PC...

  11. #11
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Changing labels caption gives error

    Try deleting the label, save, close and reopen, then add a new label. Any difference?

    Also, on the problem machine with excel closed, search the C: drive for .exd files and delete any you find, then try the workbook again.

  12. #12
    Registered User
    Join Date
    01-14-2009
    Location
    Portugal
    MS-Off Ver
    Excel 2007
    Posts
    29

    Re: Changing labels caption gives error

    I think for today is done...
    Before I do what you said, now the problem machine opened the file without problem, don't ask me why!!!
    In the problem machine I didn't find any .exd files.
    Meanwhile I will do what you advise me to do in your last reply (delete the labels and place new ones).
    I will send you feedback about it.
    Thank you so much for your help.
    Regards,
    Mário

  13. #13
    Forum Expert OnErrorGoto0's Avatar
    Join Date
    12-30-2011
    Location
    I DO NOT POST HERE ANYMORE
    MS-Off Ver
    I DO NOT POST HERE ANYMORE
    Posts
    1,655

    Re: Changing labels caption gives error

    There should always be .exd files if you are using forms. You need to check in hidden folders too.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1