Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 01-26-2016, 06:28 AM
D2A6G D2A6G is offline Saving an Excel document to PDF - VBA Windows 10 Saving an Excel document to PDF - VBA Office 2010 32bit
Novice
Saving an Excel document to PDF - VBA
 
Join Date: Jan 2016
Posts: 1
D2A6G is on a distinguished road
Default Saving an Excel document to PDF - VBA

Hi,

Basically i am trying to save my excel sheet to a PDF by using a VBA. What i have tried doing is saving the document under my current sheet name (as i have multiple sheets), so i dont have to edit the PDF afterwards in terms of name.

This is what ive got so far

Sub PDF()

Dim strXLName As String, strPDFName As String, intPos As Integer

strXLName = ActiveSheet.Name
intPos = InStr(1, strXLName, ".")
strPDFName = Left(strXLName, intPos) & "pdf"

ActiveSheet.ExportAsFixedFormat _
Type:=xlTypePDF, _
Filename:=strPDFName, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True

End Sub

But this does not save it as the sheet name like i want it too?, even just a certain cell it saves it as would be alright?, any ideas?
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Saving As a 2013 document into 2007 document. mohsen.amiri Word 3 07-02-2015 02:44 PM
Saving excel document as PDF (centered on PDF page) jyfuller Excel Programming 3 03-30-2015 12:24 PM
Saving an Excel document to PDF - VBA Problem with saving document after paste some contents from another document expert4knowledge Word 3 11-26-2013 03:53 AM
Saving an Excel document to PDF - VBA saving data in excel 2010 from excel 2003 johnkcalg Excel 1 02-06-2012 07:33 PM
Update Document Template when Saving the Document File bjbercaw Word 3 11-16-2010 02:03 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:35 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft