+ Reply to Thread
Results 1 to 3 of 3

VBA for excel 2000 It seems a Microsoft problem?

  1. #1
    Registered User
    Join Date
    05-26-2005
    Posts
    4

    VBA for excel 2000 It seems a Microsoft problem?

    Hello,

    Operating system: windows 2000 professional
    Excel version: Microsoft Excel 2000 (9.0.2720)

    I have already put two times in the issue list but now I can define the problem exactly. If I use the following piece of code then the excel file is corrupt:

    [VBA]
    Sub test_Add_Del_Sheet()
    '
    ' test_Add_Del_Sheet Macro
    ' Macro recorded 5/27/2005 by NUON
    '
    ' Keyboard Shortcut: Ctrl+g
    '
    Sheets.Add
    Sheets("Sheet2").Select
    Sheets("Sheet2").Move After:=Sheets(2)
    Sheets("Sheet2").Select
    Sheets("Sheet2").Name = "Temp_KV"
    Sheets.Add
    Sheets("Sheet3").Select
    Sheets("Sheet3").Move After:=Sheets(3)
    Sheets("Sheet3").Select
    Sheets("Sheet3").Name = "Temp_LL"

    Application.DisplayAlerts = False

    Sheets("Temp_KV").Select
    ActiveWindow.SelectedSheets.Delete
    Sheets("Temp_LL").Select
    ActiveWindow.SelectedSheets.Delete

    ChDir "S:\dms\tools\dev_dbb"

    ActiveWorkbook.Close savechanges:=True
    End Sub
    [/VBA]

    If open the file after running this macro the file is corrupt. See my attachement for the error I get.

    Have anybody a idea or suggestion why this is not working? Do I need a excel update? I can open the file with excel 2003! If I delete the statement Activeworkbook.close ..... and save the file manually, then the file is not corrupted!???

    Nico
    Attached Images Attached Images

  2. #2
    Forum Contributor
    Join Date
    11-16-2004
    Posts
    282
    Hi Nico,

    Try saving the file by using the Save method before closing it. Add this line of code right before the ActiveWorkbook.Close...statement:

    ActiveWorkbook.Save

    Hope this helps,
    theDude

  3. #3
    Registered User
    Join Date
    05-26-2005
    Posts
    4
    Hello Dude,

    No, this doesn't help. I have tried a lot also this one. It seems that saveas helps because then as parameter you have the opportunity to say Format:= xlNormal. But I have also situations that it doesn't work always. So I now try to install SR-1 and sp3 but that is a great mission. It seems that at microsoft it is well known problem!

    Thanks,

    Nico.

+ 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