+ Reply to Thread
Results 1 to 4 of 4

ActiveWorkbook.Close (False)

Hybrid View

  1. #1
    stefan via OfficeKB.com
    Guest

    ActiveWorkbook.Close (False)

    Hi,
    Excel - shut down.
    When i remove the line
    ActiveWorkbook.Close True (or False)
    from my code, i do not get the error. I can close the file manually and i can
    close Excel manually.
    With the line of code, the macro runs, saves the workbook, gives the
    completion message box, and generates the Excel error. Shutting Excel down.
    It states it creates an error log. I have no clue where to look for that log.

    Strange thing is that i tested this under Win and Excel XP at home and it
    worked like a charm.

    Thank you for your help.

    Stefan
    ----------------------
    Sub Save_1_From_User_1()
    'On Error Resume Next
    Dim strdate As String
    strdate = Format(Now, "dd-mmm-yy -- hh-mm-ss -- ")
    Application.ScreenUpdating = False
    ' Mark to activate macro for user 2
    Range("A1").Select
    ActiveCell.FormulaR1C1 = "x"
    ' Copy/paste User Name formula to text only
    Range("UserNameRange").Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlValues
    ' Save the service form to location 1
    ' ActiveWorkbook.SaveAs "serviceformcopy.xls" ' Test Location/name 1
    ActiveWorkbook.SaveAs "L:\Consultant service\Returns\Service_Forms\" &
    "ID " & Sheets("Service Form").Range("C9") _
    & " -- " & strdate & " from " & UserName & ".xls"
    Application.ScreenUpdating = True
    ' Completion message and close of workbook
    MsgBox "Submitted Successfully. - Thank you.", vbInformation, "Submission
    Notice"
    ActiveWorkbook.Close (False) '<= problem child
    End Sub


    --
    Message posted via OfficeKB.com
    http://www.officekb.com/Uwe/Forums.a...mming/200507/1

  2. #2
    Dave Peterson
    Guest

    Re: ActiveWorkbook.Close (False)

    Look for something like: drwtsn32.log or drwatson.log

    But once you find it, I bet it won't help.

    If it fails on that line (which looks ok to me), maybe you can try the code in a
    test workbook.

    Could it be that there's somekind of corruption happening with that workbook?



    "stefan via OfficeKB.com" wrote:
    >
    > Hi,
    > Excel - shut down.
    > When i remove the line
    > ActiveWorkbook.Close True (or False)
    > from my code, i do not get the error. I can close the file manually and i can
    > close Excel manually.
    > With the line of code, the macro runs, saves the workbook, gives the
    > completion message box, and generates the Excel error. Shutting Excel down.
    > It states it creates an error log. I have no clue where to look for that log.
    >
    > Strange thing is that i tested this under Win and Excel XP at home and it
    > worked like a charm.
    >
    > Thank you for your help.
    >
    > Stefan
    > ----------------------
    > Sub Save_1_From_User_1()
    > 'On Error Resume Next
    > Dim strdate As String
    > strdate = Format(Now, "dd-mmm-yy -- hh-mm-ss -- ")
    > Application.ScreenUpdating = False
    > ' Mark to activate macro for user 2
    > Range("A1").Select
    > ActiveCell.FormulaR1C1 = "x"
    > ' Copy/paste User Name formula to text only
    > Range("UserNameRange").Select
    > Selection.Copy
    > Selection.PasteSpecial Paste:=xlValues
    > ' Save the service form to location 1
    > ' ActiveWorkbook.SaveAs "serviceformcopy.xls" ' Test Location/name 1
    > ActiveWorkbook.SaveAs "L:\Consultant service\Returns\Service_Forms\" &
    > "ID " & Sheets("Service Form").Range("C9") _
    > & " -- " & strdate & " from " & UserName & ".xls"
    > Application.ScreenUpdating = True
    > ' Completion message and close of workbook
    > MsgBox "Submitted Successfully. - Thank you.", vbInformation, "Submission
    > Notice"
    > ActiveWorkbook.Close (False) '<= problem child
    > End Sub
    >
    > --
    > Message posted via OfficeKB.com
    > http://www.officekb.com/Uwe/Forums.a...mming/200507/1


    --

    Dave Peterson

  3. #3
    stefan via OfficeKB.com
    Guest

    Re: ActiveWorkbook.Close (False)

    Hi Dave,
    First a correction.
    Although the code worked under win XP Excel 2003 last night, it no longer
    works and errors when the said line is in and does not error when the line is
    not in.

    Next. I never thought about taking that bit of code and run it in a different
    workbook. Which i did with your recommendation.
    This worked. No error and the workbook closed.
    I'm lost...not that that wouldnt be easy anyway.
    So i guess the error, although it happens or not with that specified line,
    must come from something else.
    How can i go about getting this fixed?
    If i could i'd love to post my workbook if that would help you (someone) to
    figure this out.

    Thank you for your suggestion.

    Stefan


    Dave Peterson wrote:
    >Look for something like: drwtsn32.log or drwatson.log
    >
    >But once you find it, I bet it won't help.
    >
    >If it fails on that line (which looks ok to me), maybe you can try the code in a
    >test workbook.
    >
    >Could it be that there's somekind of corruption happening with that workbook?
    >
    >> Hi,
    >> Excel - shut down.

    >[quoted text clipped - 36 lines]
    >> ActiveWorkbook.Close (False) '<= problem child
    >> End Sub

    >



    --
    Message posted via http://www.officekb.com

  4. #4
    Dave Peterson
    Guest

    Re: ActiveWorkbook.Close (False)

    My guess is since the code worked in a new workbook, it's not the code.

    I think the problem may be in the workbook itself. I think I'd try recreating
    that workbook.

    "stefan via OfficeKB.com" wrote:
    >
    > Hi Dave,
    > First a correction.
    > Although the code worked under win XP Excel 2003 last night, it no longer
    > works and errors when the said line is in and does not error when the line is
    > not in.
    >
    > Next. I never thought about taking that bit of code and run it in a different
    > workbook. Which i did with your recommendation.
    > This worked. No error and the workbook closed.
    > I'm lost...not that that wouldnt be easy anyway.
    > So i guess the error, although it happens or not with that specified line,
    > must come from something else.
    > How can i go about getting this fixed?
    > If i could i'd love to post my workbook if that would help you (someone) to
    > figure this out.
    >
    > Thank you for your suggestion.
    >
    > Stefan
    >
    > Dave Peterson wrote:
    > >Look for something like: drwtsn32.log or drwatson.log
    > >
    > >But once you find it, I bet it won't help.
    > >
    > >If it fails on that line (which looks ok to me), maybe you can try the code in a
    > >test workbook.
    > >
    > >Could it be that there's somekind of corruption happening with that workbook?
    > >
    > >> Hi,
    > >> Excel - shut down.

    > >[quoted text clipped - 36 lines]
    > >> ActiveWorkbook.Close (False) '<= problem child
    > >> End Sub

    > >

    >
    > --
    > Message posted via http://www.officekb.com


    --

    Dave Peterson

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1