Sharing Violation error when adding VBA code and then trying to save RRS feed

  • Question

  • HELP ME!

    So i'm fairly new to Visual Basic but seem to be getting the hang of it. However, my latest addition to one of my macros is being completely rejected by Excel.

    When I enter the following code, excel will accept it and will run it as apart of the macro but when i go to save the spreadsheet it states that:
    "Your changes could not be saved to 'C52BAB54xlsm' because of a sharing violation. Try saving to a different file."

    However, when this saves, it strips all VBA data.

    Excel does allow me to make any other change to the spreadsheet and macros but just not this one.

    Any ideas how to get around it?

    Thank you.

        Windows("P-Card Application Form.xlsm").Activate
        If Range("C7") = "Other" Then
            If Range("C7") = "Mr" Then
                Windows("Barclaycard Upload Template.xls").Activate
                ActiveCell.Offset(0, 1).Select
                ActiveCell.FormulaR1C1 = "M"
                Windows("Barclaycard Upload Template.xls").Activate
                ActiveCell.Offset(0, 1).Select
                ActiveCell.FormulaR1C1 = "F"
            End If
        End If

    Friday, April 24, 2015 9:23 AM


  • Hi Chrissy,

    According to the description, you were not able to save the workbook after you typo some VBA code. Which version of Office are you using? Are you save it manully?

    Based on my understanding, this issue is not realtive to the code and it maybe a know issue about Office 2007. You can fix it via link below:
    Description of the 2007 Office system hotfix package (Msoshext-x-none.msp): April 27, 2010 

    If you still have the issue save it manually, I would suggest that you reopen a new question in Microsoft Community- Excel forum to get more effective response.

    Regards & Fei

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, April 27, 2015 6:09 AM