Results 1 to 10 of 10

Saving only the current, active workbook

Threaded View

  1. #1
    Registered User
    Join Date
    05-09-2010
    Location
    US
    MS-Off Ver
    Excel 2003
    Posts
    41

    Saving only the current, active workbook

    I was given the following code and when I added it to my project, it did not work as expected. It was suppose to open up a "save as" box and save only the current active workbook. For some reason it opens a "save as" box and saves a single worksheet, but the saved worksheet does not contain any of the data from the active worksheet. I've tried to tweak it to get it to work as I need, but no luck. Any ideas?

    Sub Macro1()
       Dim fileSaveName
       fileSaveName = Application.GetSaveAsFilename("Excel Files (*.xl*), *.xl")
       If fileSaveName = False Then
          MsgBox "No name selected"
          Exit Sub
       End If
        
       Application.ScreenUpdating = False
       ThisWorkbook.ActiveSheet.Copy
       ActiveWorkbook.SaveAs Filename:=fileSaveName, FileFormat:=xlNormal
       ActiveWorkbook.Close
       Application.ScreenUpdating = True
    End Sub
    Last edited by SinGin; 05-16-2010 at 10:41 AM.

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