+ Reply to Thread
Results 1 to 2 of 2

macro issue

  1. #1
    Registered User
    Join Date
    01-21-2005
    Posts
    1

    macro issue

    i have developed the following code;
    -------------------

    Sub Macro1()
    '
    ' Macro1 Macro
    ' Macro recorded 1/19/2005 by femig
    '
    '
    Application.ScreenUpdating = False ' turn off the screen updating
    Application.OnTime TimeValue("11:22:00"), "Macro1"
    Range("B45:O47").Select
    Selection.Copy
    Workbooks.Add
    ActiveSheet.Paste
    Application.CutCopyMode = False
    If Dir("C:\xls_data\copy.xls") <> "" Then
    ' the file exists, returns "" (empty string) if the file doesn't exist.
    Kill "C:\xls_data\copy.xls"
    Else
    ActiveWorkbook.SaveAs Filename:="C:\xls_data\copy.xls", FileFormat:= _
    xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False _
    , CreateBackup:=False
    End If
    End Sub

    ----------------------------------

    when i run thid macro i find that the file "copy.xls" is opened on my pc.
    .i dont want this..
    i simply want to go to windows explorer and see the file in the folder xls_data.
    how can i do this?
    thanks

  2. #2
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,259
    Hello Femig,

    You have added a new workbook and saved it as "Copy.xls". At the end of your code add Workbook.Close .This should take care of the problem.

    Best,
    Leith Ross

+ 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