+ Reply to Thread
Results 1 to 12 of 12

Compile error on newly recorded macro

  1. #1
    Registered User
    Join Date
    08-08-2020
    Location
    dc
    MS-Off Ver
    2020
    Posts
    6

    Compile error on newly recorded macro

    The laptop that I have was given to someone who had a VBA course. Something unknown to the user/myself was done to this laptop during the course and now it can't do a simple recorded macro like it used to. It comes up with a "compile error". I've done this macro several times, along with other macros and it just doesn't work.

    I've tried to see if there any autoexec macros, hidden macros listed in personal macros (unhide workbooks), under macros there are non listed. I have another version of Excel on the same laptop and it works just fine.


    I'm totally stumped. Please help. I have to teach recording macros next week and I can't.

    Here is my u tube address ending vIYfgP03Qx4

  2. #2
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: VBA Compile Mystery

    If it shows a compile error, then there is probably code with a compile error, possibly from someone accidentally changing the code. It is almost certainly not the computer but the Excel file with this code. Can you go to the VBA development window when the compile error occurs and see what code is causing it?
    Jeff
    | | |·| |·| |·| |·| | |:| | |·| |·|
    Read the rules
    Use code tags to [code]enclose your code![/code]

  3. #3
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: VBA Compile Mystery

    I viewed your video and I have a better idea of your problem although I have never seen this before. The code you are showing has absolutely no relation to the actions you took when recording the macro. In addition, it is just wrong. That code looks like it was written by hand by someone who doesn't know how to write VBA.

    Somehow the module is being seeded with code that was written earlier, but I do not know how this is possible. The only thing I can think of is to check to see if there is an Excel file configured to use as a template for new files that has some bad code in it. I suggest you check to see if there is anything unexpected in the startup folder.

    If you don't know where your startup folder is, you can find it in File, Options, Advanced:

    startup.JPG

  4. #4
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Compile error on newly recorded macro

    I've seen this quite a few times, but cannot remember what the cause was.
    Along with what 6String has suggested, do you have any add-ins, or COM add-ins loaded?

  5. #5
    Registered User
    Join Date
    08-08-2020
    Location
    dc
    MS-Off Ver
    2020
    Posts
    6

    Re: VBA Compile Mystery

    Reply to the first response#Hmmm no that wasn't the case. If you look at the video,you will see that I just recorded a few simple steps. Something just isn't right..

    I'll check your second and third suggestions.

  6. #6
    Registered User
    Join Date
    08-08-2020
    Location
    dc
    MS-Off Ver
    2020
    Posts
    6

    Re: VBA Compile Mystery

    Quote Originally Posted by 6StringJazzer View Post
    I viewed your video and I have a better idea of your problem although I have never seen this before. The code you are showing has absolutely no relation to the actions you took when recording the macro. In addition, it is just wrong. That code looks like it was written by hand by someone who doesn't know how to write VBA.

    Somehow the module is being seeded with code that was written earlier, but I do not know how this is possible. The only thing I can think of is to check to see if there is an Excel file configured to use as a template for new files that has some bad code in it. I suggest you check to see if there is anything unexpected in the startup folder.

    If you don't know where your startup folder is, you can find it in File, Options, Advanced:

    Attachment 690180
    In Excel 2016, if I go to File, Options , Advanced, I do not see a category for Startup folder. I did, however, check to see if there were some obscure file names where Book 1 should be in places ie: display options for this workbook etc and they all say Book 1.

  7. #7
    Registered User
    Join Date
    08-08-2020
    Location
    dc
    MS-Off Ver
    2020
    Posts
    6

    Re: Compile error on newly recorded macro

    Quote Originally Posted by Fluff13 View Post
    I've seen this quite a few times, but cannot remember what the cause was.
    Along with what 6String has suggested, do you have any add-ins, or COM add-ins loaded?
    No active application add ins nor COM add ins loaded,.'


    yup this question is a doozie.

  8. #8
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Compile error on newly recorded macro

    What is the other version of Excel that you are running on that machine?

  9. #9
    Registered User
    Join Date
    08-08-2020
    Location
    dc
    MS-Off Ver
    2020
    Posts
    6
    Quote Originally Posted by Fluff13 View Post
    What is the other version of Excel that you are running on that machine?
    365

    I have had both versions for the same amount of time and was able to perform the exact same macro before that VBA course.

  10. #10
    Registered User
    Join Date
    08-08-2020
    Location
    dc
    MS-Off Ver
    2020
    Posts
    6
    Quote Originally Posted by 6StringJazzer View Post
    I viewed your video and I have a better idea of your problem although I have never seen this before. The code you are showing has absolutely no relation to the actions you took when recording the macro. In addition, it is just wrong. That code looks like it was written by hand by someone who doesn't know how to write VBA.

    Somehow the module is being seeded with code that was written earlier, but I do not know how this is possible. The only thing I can think of is to check to see if there is an Excel file configured to use as a template for new files that has some bad code in it. I suggest you check to see if there is anything unexpected in the startup folder.

    If you don't know where your startup folder is, you can find it in File, Options, Advanced:

    Attachment 690180

    The picture of the startup string in the jpg is not fully displayed.
    Could you please copy and paste in the reply? I’m sure that not everything will be the same but maybe I can see something that might help .

  11. #11
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,721

    Re: Compile error on newly recorded macro

    Mine is a custom folder, so that won't help you. Yours is probably the default. Look for a folder on your system called XLSTART. Try the Trust Center under Trusted locations.
    startup.JPG

  12. #12
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,080

    Re: Compile error on newly recorded macro

    I didn't think you could have both a subscription & stand alone version of Excel installed on the same computer.

+ 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. Recorded Macro that has error
    By exc1967 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 03-02-2020, 01:53 PM
  2. Subscript out of Range error on recorded macro
    By Benatfox in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-04-2018, 07:47 PM
  3. Run Recorded Macro but has error
    By Faye_Xu in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-28-2015, 02:29 AM
  4. [SOLVED] Recorded Formula Gives Compile Error
    By Jonathan78 in forum Excel General
    Replies: 11
    Last Post: 05-13-2015, 03:55 AM
  5. Recorded pivot macro run time error 5
    By cindywylie in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 04-18-2014, 08:38 PM
  6. Recorded macro gets formula error
    By CityMPLSEmpolyee in forum Excel Programming / VBA / Macros
    Replies: 12
    Last Post: 02-10-2012, 09:28 AM
  7. Error in a simple recorded Macro
    By modytrane in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-10-2008, 11:23 AM

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