Last active
          April 25, 2018 14:05 
        
      - 
      
- 
        Save kebien6020/5d92f58af66d16f8418d5c3f84b5a29a to your computer and use it in GitHub Desktop. 
    Excel macro to Instantly export as pdf in the same folder
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | Sub ExportAsPDF() | |
| 'Instantly export as pdf in the same folder | |
| Dim filename As String | |
| filename = ActiveWorkbook.FullName | |
| filename = Replace(filename, ".xlsm", ".pdf") | |
| filename = Replace(filename, ".xlsx", ".pdf") | |
| filename = Replace(filename, ".xls", ".pdf") | |
| filename = Replace(filename, ".xlb", ".pdf") | |
| ActiveWorkbook.ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:= _ | |
| filename, Quality:= _ | |
| xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _ | |
| OpenAfterPublish:=False | |
| End Sub | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment