2015-01-15 49 views
0

我需要在电子邮件中发送一系列单元格,但格式为pdf文件。现在我可以创建pdf并保存它,但由于excel文件将用于不同的计算机,所以我现在无法获取文件的路径并以此方式进行附加。是否可以马上将范围附加到电子邮件中?或者提示一个窗口,以便用户选择他保存PDF的位置,然后我可以使用该路径将其附加到电子邮件。 Thks!在特定位置将范围保存为pdf

+0

你是如何创建PDF? – PaulFrancis 2015-01-15 17:05:19

+1

如果PDF文件只是temproray,则可以将其保存到用户的Temp文件夹中。 'FileSystemObject'有一个方法来找到这个:http://msdn.microsoft.com/en-us/library/a72y2t1c(v=vs.84).aspx – 2015-01-15 17:10:10

+0

可能重复[如何获取当前工作表的路径在VBA?](http://stackoverflow.com/questions/2813925/how-to-get-the-path-of-current-worksheet-in-vba) – Chrismas007 2015-01-15 17:16:37

回答

0

Application.Workbook().Path应该得到你所需要的:

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.