+ Reply to Thread
Results 1 to 2 of 2

Save selected pages to desktop without running each page code?

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    04-22-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    329

    Save selected pages to desktop without running each page code?

    Good day all,

    I have a code that saves a selected set of pages from a workbook, i know the code works but for some reason it comes up with an error code of "Runtime-error "9": Subscript out of range? Anybody have any ideas to bypass the page code or to solve the error, thanks heaps guys & have a great day - Marco


    Private Sub CommandButton2_Click()
    
        Sheets(Array("PAGE 1", "PAGE 2", "PAGE 3", "Page4+", "Rescue Plan", "Final Page")). _
            Copy
            
            Dim FPATH As String
        FPATH = "C:\Users\username\Desktop\SWMSRecords\"
        ActiveWorkbook.SaveAs FPATH & Sheets("PAGE 1").Range("T1").Value & ".xlsx"
        ActiveWorkbook.Close
        
        Windows("SWMS Final1.xlsm").Activate
        Sheets("Start").Select
        
    End Sub

  2. #2
    Forum Contributor
    Join Date
    04-22-2012
    Location
    Australia
    MS-Off Ver
    Excel 2016
    Posts
    329

    Re: Save selected pages to desktop without running each page code?

    Hi all,

    Just a quick update, I eventually just slowed the code down with "DoEvents" to get it to work, hopefully this may help someone with a similar issue? Thanks any way guys & have a great day - Marco

+ 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