Results 1 to 3 of 3

having problems with Workbook AfterSave vba code

Threaded View

  1. #1
    Forum Contributor sspreyer's Avatar
    Join Date
    07-05-2013
    Location
    london
    MS-Off Ver
    Excel 2010
    Posts
    180

    having problems with Workbook AfterSave vba code

    hi everyone i have to bit of code that is action after workbook is saved code is shown below have problem getting to run together any ideas to put this together hope you all understand thanks in advance
    1st macro save active sheet to pdf
    2nd macro saves entire workbook to pdf

    cheers

    shane
    Private Sub Workbook_AfterSave(ByVal Success As Boolean)
    Dim Filename As String
    Dim Filepath As String
    Filepath = "C:\Users\Shane\Documents\"
    Filename = Filepath & "monthly" 'ThisWorkbook.Name
    If Success Then
      ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Filename, _
      Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
      OpenAfterPublish:=False
    End If
            
    End Sub
    
    Private Sub Workbook_AfterSave(ByVal Success As Boolean)
    
    
      Dim Filename As String
        Dim Filepath As String
       
            Filepath = "C:\Users\Shane\Documents\"
            Filename = Filepath & "YTD" 'ThisWorkbook.Name
    
    
            If Success Then
               ThisWorkbook.ExportAsFixedFormat Type:=xlTypePDF, Filename:=Filename, _
                     Quality:=xlQualityStandard, _
                     IncludeDocProperties:=True, _
                     IgnorePrintAreas:=True, _
                     OpenAfterPublish:=False
            End If
            
    End Sub
    i have also post this http://www.mrexcel.com/forum/excel-q...ml#post3550338
    Last edited by sspreyer; 08-18-2013 at 10:41 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA code to start macro 'AfterSave' function
    By bchurchi in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-07-2013, 01:07 PM
  2. Aftersave macro. adding a date to cell when the sheets protected
    By kjshep in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-25-2012, 10:28 AM
  3. having problems with code to allow saving in a workbook
    By 2funny4words in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-29-2009, 07:37 PM
  4. Code creates new workbook-> code to automatically run a set code on that workbook
    By cwalker6 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 05-20-2009, 08:00 PM
  5. Have a few problems with code, workbook merging
    By cultavix in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-17-2008, 10:43 AM

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