Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-27-2016, 10:34 AM
IAMCHEESE IAMCHEESE is offline Save Excel file with specific cell value by using VBA code Windows 10 Save Excel file with specific cell value by using VBA code Office 2016
Novice
Save Excel file with specific cell value by using VBA code
 
Join Date: Oct 2016
Posts: 1
IAMCHEESE is on a distinguished road
Default Save Excel file with specific cell value by using VBA code

Help!! I am trying to finish a new tool to use in our shop and I have a couple of steps I can't figure out......

1) I would like to create a macro that will save a file using the contents of a specific cell (customers name) as the file name. I found this script that works, but I can't figure out how to execute the command!

VBA code: Save Excel file with specific cell value

Private Sub filename_cellvalue()
'Update 20141112


Dim Path As String
Dim filename As String
Path = "C:\Users\dt\Desktop\my information\"
filename = Range("A1")
ActiveWorkbook.SaveAs filename:=Path & filename & ".xls", FileFormat:=xlNormal
End Sub

and

2) I would like to record a macro that exports the .xlsm file into a .pdf, so I can send it to the customer in that format, not an excel file.
Reply With Quote
  #2  
Old 11-02-2016, 07:11 PM
macropod's Avatar
macropod macropod is offline Save Excel file with specific cell value by using VBA code Windows 7 64bit Save Excel file with specific cell value by using VBA code Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,962
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

How you would execute the code depends on what you want to use it with. If it's intended to be run as a stand-alone macro, simply delete 'Private '. You will then be able to access it via Alt-F8, for example.

To save as a PDF, you'd probably want to use the ExportAsFixedFormat method, so you can specify the output range, etc. See Excel VBA help file for details. You could add that method to your existing sub.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Save Excel file with specific cell value by using VBA code Save as File for Excel 2010 mbesspiata Excel Programming 2 02-03-2016 07:10 AM
Save Excel file with specific cell value by using VBA code Save as File for Excel 2010 mbesspiata Excel 1 11-18-2015 08:52 AM
Save Excel file with specific cell value by using VBA code Code for mail merge to reference saved excel file jtemp57 Word VBA 10 12-16-2013 11:02 PM
Save Excel file with specific cell value by using VBA code VB code: populate combobox from columns in Excel file billybeach Outlook 2 04-27-2013 04:38 AM
Insert an item to excel specific cell apjneeraj Excel 0 01-18-2011 03:39 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 03:42 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