• RunTime Error 1004 (EXCEL 97; Win 98)

    Author
    Topic
    #385421

    I am just beginning to use EXCEL VBA. Have the following code in the start-up module:
    Option Explicit
    Private Sub Workbook_Open()
    With Worksheets(“WORK_ORDER”).Range(“D7”)
    If .Value = “” Then
    .Value = “CD-0001”
    Else
    .Value = Left(.Value, 3) & Format(Right(.Value, 4) + 1, “0000”)
    End If
    End With
    ActiveWorkbook.Save
    Worksheets(“WORK_ORDER”).Select
    End Sub

    Receive a Runtime Error 1004, Document not saved message. I believe the syntax is correct. Anyone have an idea as to what I am doing wrong?

    Viewing 0 reply threads
    Author
    Replies
    • #664756

      Works for me in Excel2000 SP-3. Do you have another workbook open? If so you might want to change ActiveWorkbook to ThisWorkbook.Save. Do you have the code behind the Workbook module? That is where you want it.

    Viewing 0 reply threads
    Reply To: RunTime Error 1004 (EXCEL 97; Win 98)

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: