+ Reply to Thread
Results 1 to 17 of 17

Run Time Error 1004

  1. #1
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Crayford, kent
    MS-Off Ver
    Excel 2013
    Posts
    394

    Run Time Error 1004

    Hi All

    Im getting a run time error on
    Please Login or Register  to view this content.
    It seemed to happen after i added this bit of code in....
    Please Login or Register  to view this content.
    Would anyone know where the error is coming from?, it only highlghts the userform1.show bit on the debug and my code to show the userform is this

    Please Login or Register  to view this content.
    Any solution or advice would be great, as this is getting rather annoyign now

    thanks Dan

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Run Time Error 1004

    Please Login or Register  to view this content.
    Did you mean to use a userform then maybe change the typo.

    Please Login or Register  to view this content.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Crayford, kent
    MS-Off Ver
    Excel 2013
    Posts
    394

    Re: Run Time Error 1004

    Haha, sorry that was me just typing the code down, rather than copying, my mistake

    That isnt how it is spelt in vb

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Run Time Error 1004

    You can set a breakpoint in the routine in order to aid debugging.

    I would guess, whithout seeing all your code, that the variable mChartNum is zero.
    Cheers
    Andy
    www.andypope.info

  5. #5
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Crayford, kent
    MS-Off Ver
    Excel 2013
    Posts
    394

    Re: Run Time Error 1004

    hi Andy

    It is, this is what you helped me out with the other day when it just wouldnt add the gif to the userform, i have built on that to add 8 gif's and it was workign fine, then when i reopened the book it now has this error,

    Chartnum = 1

    Please Login or Register  to view this content.
    then

    Please Login or Register  to view this content.
    The module is what you gave me

    Please Login or Register  to view this content.

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Run Time Error 1004

    Try adding a breakpoint in the routine and step through the code and see if you can isolate the line that errors.

    The error code would suggest you are try in reference a sheet or chartobject that does not exsist.

  7. #7
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Crayford, kent
    MS-Off Ver
    Excel 2013
    Posts
    394

    Re: Run Time Error 1004

    Right ive managed to get rid of the runtime error 1004, now im getting run time error 481, but there are no invalid pictures! theres 8 charts all reference by mchartnum then + by num to get what chart i want in what image control

    But its still on the same line, which i changed to create userform 2 snip.PNG

    Surely theres a simple solution to this as it was working fine yesterday

  8. #8
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Run Time Error 1004

    Press SHIFT+F8 to step into the initialize event.

    also I assume vb modeless is a typo. vbModeless

  9. #9
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Crayford, kent
    MS-Off Ver
    Excel 2013
    Posts
    394

    Re: Run Time Error 1004

    right here is the example file.

    I have run through the first code workbook_open and its definately on the userform2.show, there is a slight issue i have just noticed and dont know if it is affecting this workbook

    I have two xlam projects which i have no idea what they are, or where they come from, they are password protected to so i cant open or delete!

    These are the ATPVBAEN and EUROTOOL....
    Attached Files Attached Files

  10. #10
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Crayford, kent
    MS-Off Ver
    Excel 2013
    Posts
    394

    Re: Run Time Error 1004

    yep its a typo haha, sorry

  11. #11
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Crayford, kent
    MS-Off Ver
    Excel 2013
    Posts
    394

    Re: Run Time Error 1004

    Ok so i change userform_initialize to userform1_initalize and it opens up the form but adds non of the text or images

  12. #12
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Run Time Error 1004

    Those are MS addins for Analysis toolspak and Eurotool, red herrings I think.

    Can you check the file size of the temp.gif file. I get Invalid picture type when the file is zero bytes small.

  13. #13
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Crayford, kent
    MS-Off Ver
    Excel 2013
    Posts
    394

    Re: Run Time Error 1004

    Ok so nothing to worry about then

    You are right it is 0kb, would it help to change them to jpeg or PNG?

  14. #14
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Run Time Error 1004

    I refactored the code and it appears to be working now.

    Please Login or Register  to view this content.
    Attached Files Attached Files

  15. #15
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Crayford, kent
    MS-Off Ver
    Excel 2013
    Posts
    394

    Re: Run Time Error 1004

    Weird, im still getting errors on your sheet and on mine, yours is telling me that the activate method failed, on activate charts, and mine is still telling me invalid picture, when i use your example above

  16. #16
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,436

    Re: Run Time Error 1004

    Restart excel and delete all those temp gif files and try again

  17. #17
    Forum Contributor
    Join Date
    04-12-2013
    Location
    Crayford, kent
    MS-Off Ver
    Excel 2013
    Posts
    394

    Re: Run Time Error 1004

    Right i restated excel, then restarted the laptop, then wanted to kick the laptop, then ive fixed it

    i changed chartnum = 1 to chartnum = 0

    the on the workbook_open sequence i added code to select all charts (activate) before the userform1.show command.

    it works! may not be the right way to do it, but it works again, thanks for helping again and trying to explain to me the procedures in fixing the issue

    Dan

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Addon error : Run-time error '1004': Method 'MacroOptions' of object '_Application' failed
    By jtcoleman in forum For Other Platforms(Mac, Google Docs, Mobile OS etc)
    Replies: 3
    Last Post: 02-05-2014, 12:23 PM
  2. Replies: 4
    Last Post: 11-15-2013, 05:03 PM
  3. VBA Code...error = run time error 1004 autofilter method of range class failed
    By Dariusd7 in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 11-15-2013, 04:49 PM
  4. Error "run-time Error '1004': General Odbc Error
    By D4WNO77 in forum Access Tables & Databases
    Replies: 2
    Last Post: 07-16-2012, 09:55 AM
  5. [SOLVED] run-time error '1004': Application-defined or object-deifined error
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-10-2005, 05:05 PM

Tags for this Thread

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