Consulting

Results 1 to 2 of 2

Thread: Crashes When Saving

  1. #1

    Crashes When Saving

    Hi guys,

    I really need your help please!

    I have a spreadsheet that keeps crashing when I am trying to save. The spreadsheet is saved on a pc and can be accessed by other users on the network through a mapped shared folder.

    I have a button on the sheet which runs the following code:

    [vba]Option Explicit[/vba][vba]
    Sub Save_Password()
    Dim Open_Password As String
    Dim New_File_Name As String

    New_File_Name = Range("G2").Value & "\" & Range("G1").Value & ".xlsm"
    Open_Password = InputBox("Please enter a password to stop others from editing your timesheet. YOU MUST REMEMBER THIS PASSWORD")
    ActiveWorkbook.SaveAs New_File_Name, _
    WriteResPassword:=Open_Password, _
    Password:="heather"


    ' ActiveWorkbook.SaveAs New_File_Name, _ ' creates a new file with the name in G1
    ' Password:=Open_Password, _ ' this is the password the user enters
    ' WriteResPassword:="password" ' this is the master password

    End Sub[/vba]

    When this is clicked the spreadsheet stops responding and eventually I will get a RUN TIME ERROR 1004 method saveas of object _workbook failed

    But, when I go through the file save as option, using the exact same method as my VBA code it works flawlessly.

    Also, to make this even more confusing....when I try it on the computer it’s stored on, it works flawlessly.
    This only happens when I access it from another computer on the network and use the VBA option.

    Any ideas??

  2. #2
    Quote Originally Posted by Andybuck86
    Hi guys,

    I really need your help please!

    I have a spreadsheet that keeps crashing when I am trying to save. The spreadsheet is saved on a pc and can be accessed by other users on the network through a mapped shared folder.

    I have a button on the sheet which runs the following code:

    [vba]Option Explicit[/vba][vba]
    Sub Save_Password()
    Dim Open_Password As String
    Dim New_File_Name As String

    New_File_Name = Range("G2").Value & "\" & Range("G1").Value & ".xlsm"
    Open_Password = InputBox("Please enter a password to stop others from editing your timesheet. YOU MUST REMEMBER THIS PASSWORD")
    ActiveWorkbook.SaveAs New_File_Name, _
    WriteResPassword:=Open_Password, _
    Password:="heather"


    ' ActiveWorkbook.SaveAs New_File_Name, _ ' creates a new file with the name in G1
    ' Password:=Open_Password, _ ' this is the password the user enters
    ' WriteResPassword:="password" ' this is the master password

    End Sub[/vba]

    When this is clicked the spreadsheet stops responding and eventually I will get a RUN TIME ERROR 1004 method saveas of object _workbook failed

    But, when I go through the file save as option, using the exact same method as my VBA code it works flawlessly.

    Also, to make this even more confusing....when I try it on the computer it’s stored on, it works flawlessly.
    This only happens when I access it from another computer on the network and use the VBA option.

    Any ideas??
    I also just noticed a windows error message - something along the lines of 'data execution prevention'. Does anyone know anything about this?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •