+ Reply to Thread
Results 1 to 7 of 7

Excel Macro throwing Runtime error 5 when file is shared!

  1. #1
    Registered User
    Join Date
    09-25-2019
    Location
    Hyderabad, India
    MS-Off Ver
    16
    Posts
    4

    Excel Macro throwing Runtime error 5 when file is shared!

    I've googled all day and need help fixing this issue.

    I've recorded a macro for a data to create a pivot table and filter data, both copied to different sheets. When I run the macro, it works fine. I have emailed the workbook to my colleague and when he tries to run the macro, it throws an error "Run-time error '5': Invalid procedure call or argument". I have tried all possible steps to fix this but nothing worked. Below are few steps I've tried and checked:

    1. Tried saving the excel file as .xlsx and macro module as .bas separately and sharing the files. Then importing the macro module and saving the workbook as .xlsm
    2. Tried enabling the Macro security feature to run all macros on my colleague's system.
    3. Sharing the file through a completely different medium.
    4. Enabled Developer Tab on my colleague's system.
    5. Ensured there's no space between the words in sheet tab name.

    One thing I observed is, I set a color format to certain cells in pivot table which the macro creates automatically when run. And when I delete the data to run the macro again, the color formatting is gone, on my system. When I try the same on my colleague's pc, data is deleted but color formatting is still there indicating there's some issue. I have no idea what it is.


    Please Login or Register  to view this content.
    When I run the macro on my colleague's system, click on Debug on the error pop-up, this is what I see.

    Macro error.PNG
    Macro error_2.PNG

    Any help is much appreciated! Thanks.
    Last edited by murali.a.89; 11-07-2019 at 05:37 AM. Reason: Attaching an image

  2. #2
    Forum Guru :) Sixthsense :)'s Avatar
    Join Date
    01-01-2012
    Location
    India>Tamilnadu>Chennai
    MS-Off Ver
    2003 To 2010
    Posts
    12,770

    Re: Excel Macro throwing Runtime error 5 when file is shared!

    Whether masterdata worksheet exists in that workbook?

    Please post the screen shot of the error too.


    If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
    Mark your thread as Solved


    If the suggestion helps you, then Click *below to Add Reputation

  3. #3
    Registered User
    Join Date
    09-25-2019
    Location
    Hyderabad, India
    MS-Off Ver
    16
    Posts
    4

    Re: Excel Macro throwing Runtime error 5 when file is shared!

    Thanks, yes MasterData sheet exists along with other tabs just as they do on my computer. I've edited the post and attached the screenshot of the error.

  4. #4
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,907

    Re: Excel Macro throwing Runtime error 5 when file is shared!

    Does he have Office 2016? If not, you can't use 6 as the version number.
    Rory

  5. #5
    Registered User
    Join Date
    09-25-2019
    Location
    Hyderabad, India
    MS-Off Ver
    16
    Posts
    4

    Re: Excel Macro throwing Runtime error 5 when file is shared!

    Thank you so much. You might be right. He's on excel 2013. What should I replace "version=6" with?

  6. #6
    Forum Expert rorya's Avatar
    Join Date
    08-13-2008
    Location
    East Sussex, UK
    MS-Off Ver
    365 Ent Monthly Channel / Insiders Beta
    Posts
    8,907

    Re: Excel Macro throwing Runtime error 5 when file is shared!

    You can leave it out, as it's an optional argument.

  7. #7
    Registered User
    Join Date
    09-25-2019
    Location
    Hyderabad, India
    MS-Off Ver
    16
    Posts
    4

    Re: Excel Macro throwing Runtime error 5 when file is shared!

    Hey sorry for the delay in response. You are a gem! It's so simple and I didn't know about it. It's solved.

+ 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. [SOLVED] Mac throwing error - Runtime Error 429 - ActiveX Component Can't Create Object
    By harman83 in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 11-28-2018, 11:04 PM
  2. Runtime error 1004 when running excel macro. Other users do not have same issue with file
    By macronewbie99 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-09-2018, 02:23 PM
  3. [SOLVED] SUMPRODUCT throwing RunTime Error 13 - Type mismatch
    By Ochimus in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-03-2018, 11:08 PM
  4. Excel Macro throwing a Syntax Error and I am not sure why
    By budwong27 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-14-2017, 03:43 AM
  5. Saving on shared drive with macro throwing errors once in awhile
    By siray13 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 10-06-2012, 09:01 AM
  6. .xslx file not able to open and throwing error
    By sekharyadav in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-16-2012, 01:20 PM
  7. Macro error when file is shared
    By Eric @ SEASH, Evansville in forum Excel General
    Replies: 2
    Last Post: 08-24-2005, 11: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