0

I need to send a range of Cells in an email but formatted as a pdf file. Right now Im able to create the pdf and save it, but since the excel file will be used in different computers, I cant now the paths to the files and attach it that way. Is it possible to attach the range to an email as a pdf right away? Or to prompt a window so the user selects where he saves the pdf and then I can use that path to attach it to the email. Thks!

  • How are you creating the PDF? – PaulFrancis Jan 15 '15 at 17:05
  • 1
    If the PDF file is just temproray then you can save it to the user's Temp folder. The `FileSystemObject` has a method to find this: http://msdn.microsoft.com/en-us/library/a72y2t1c(v=vs.84).aspx – Tim Williams Jan 15 '15 at 17:10
  • possible duplicate of [How to get the path of current worksheet in VBA?](http://stackoverflow.com/questions/2813925/how-to-get-the-path-of-current-worksheet-in-vba) – Chrismas007 Jan 15 '15 at 17:16

1 Answers1

0

Application.Workbook().Path should get you what you need:

Dim FolderPath As String
FolderPath = Application.Workbook("name of book.xlsm").Path
'Use your save PDF macro to save to the FolderPath string
'Reference FolderPath in attachment to message.
Community
  • 1
  • 1
Chrismas007
  • 6,085
  • 4
  • 24
  • 47