Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Mar 2001
    Location
    Canton, Ohio, USA
    Posts
    270
    Thanks
    3
    Thanked 0 Times in 0 Posts

    RunTime Error 1004 (EXCEL 97; Win 98)

    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?

  2. #2
    Star Lounger
    Join Date
    Mar 2001
    Location
    New York, USA
    Posts
    52
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: RunTime Error 1004 (EXCEL 97; Win 98)

    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.

Posting Permissions

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