none
Problem with VBA code (Excel Sheet Copy without VBA Code) (File Expiration Date) RRS feed

  • Question

  • I am SK from Nepal. I am a VBA beginner. I have VBA coded an Excel workbook (Macro Enabled Workbook crated in Office 2013 64bit on Windows 10 64 bit to be work in Windows 7 32/64, Office 2007 32/64) for school mark sheet. I have couple of problem so I would like to request you for solving following problems:

    (1) The workbook should be read only after certain period of time. (Even the user back dates the system date)

    (2) I have date conversation sheet (AD to BS Nepali Local Date different from AD) I want to add the conversation chart after the renewable of the package. I want to edit the sheet instantly with a trigger (I need the trigger code).

    (3) When the sheet copied to another workbook (New workbook) the VBA code (related to the Sheet) also copied. So I want when the user copies the sheet he may not view and copy the code only the contains of the cells should be copied. I have put VBA Project Password but it did not prevent he sheet copy.

    (4) I want to prevent unauthorized copy of the workbook. (I have already solved the problem with Disk serial number tracking).

    I want detailed VBA code for these as soon as possible.


    SK Bhattarai


    • Edited by developersk Friday, January 6, 2017 5:31 AM Title Changed
    Friday, January 6, 2017 5:17 AM

All replies

  • If you don't want the user to be able to copy code then the best method is to not supply them with a workbook containing the code. You could use VBA code to simply produce a workbook without any code and that is what you give the user. If you need code to process what the user has entered in the sheet then use VBA code to copy their worksheet to the workbook containing the code and process from there.

    Regards, OssieMac

    Friday, January 6, 2017 7:21 AM
  •  

    Hi,

    To make workbook read-only, you could save it as read-only using WriteResPassword Parameter of Workbook.SaveAs Method (Excel). Or you could mark it as final using  Workbook.Final Property (Excel)

    To edit sheet with a trigger, you could handle Worksheet.Change Event (Excel).

    To delete the macro after copying, please see the similar question

    http://stackoverflow.com/questions/32016718/copy-a-worksheet-without-copying-the-code

    Regards,

    Celeste


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, January 10, 2017 7:23 AM
    Moderator