Results 1 to 7 of 7

VB script for file name

Threaded View

Alan-53 VB script for file name 11-04-2023, 06:38 AM
AliGW Re: VB script for file name 11-04-2023, 06:39 AM
AliGW Re: VB script for file name 11-04-2023, 06:47 AM
Alan-53 Re: VB script for file name 11-04-2023, 07:15 AM
Tajan Re: VB script for file name 11-04-2023, 12:47 PM
jolivanes Re: VB script for file name 11-04-2023, 06:42 PM
Alan-53 Re: VB script for file name 11-05-2023, 04:24 AM
  1. #1
    Registered User
    Join Date
    05-20-2023
    Location
    West Midlands
    MS-Off Ver
    Excel 365 V2304 Build 16.0.16327.20200 64-bit
    Posts
    10

    VB script for file name

    Greetings all.
    I am looking for some help with the following script.
    The script work well and saves the pdf in the correct folder but i have failed to get the saved file name to work
    The file name is held in cell M1

    Sub ExpPDF()
    
    'Save PDF Document
    
    Dim PathFile As String
    Dim PathArray() As String
    Dim PathPDF As String
       
    Application.DisplayAlerts = False
    'Get file path
    PathFile = Application.ThisWorkbook.FullName
    
    'Split file path in path and file ending
    PathArray() = Split(PathFile, ".")
    
    'Creat file path with ".pdf" ending
    PathPDF = PathArray(0) & ".pdf"
        
    'PDF File is saved in directory of workbook
    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, FileName:= _
        PathPDF, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
        :=False, OpenAfterPublish:=True
        
    'Closes Workbook after generatin PDF
    ActiveWorkbook.Saved = True
    Application.Quit
    Application.DisplayAlerts = True
    
    End Sub

    Any help would be good please.
    Last edited by Alan-53; 11-05-2023 at 04:28 AM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. script to run the macro from Vb script with out opening the excel file
    By chandanp in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-27-2021, 03:33 AM
  2. [SOLVED] Need to Adapt VBA Script for my file
    By MermaidNiki in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 02-20-2017, 07:23 PM
  3. Script/macro to save a copy as tab delimited text file and then close original file
    By Merlin803 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-02-2015, 01:34 PM
  4. need help in writing a vba script to run a macro (.xlam file) on a .csv file
    By NeoDasari in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-30-2015, 02:02 PM
  5. Script or .bat needed to open office file file located in LAN
    By 823 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-28-2015, 11:06 AM
  6. Replies: 4
    Last Post: 10-17-2014, 09:31 AM
  7. Replies: 1
    Last Post: 12-20-2009, 09:17 PM

Tags for this Thread

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