Scrappy666
Board Regular
- Joined
- Jul 6, 2012
- Messages
- 215
Hi Everyone,
I've came across a small problem whilst writing my latest bit of VBA..
I have the below code which select the file format when sending a document through Outlook, however i want to send this document as a PDF.
I've tried amending the file extension to .pdf to no avail...
It does send as a PDF but it won't open the document, the error message is saying it's in the wrong file format
Select Case Sourcewb.FileFormat
Case 51: FileExtStr = ".xlsx": FileFormatNum = 51
Case 52:
If .HasVBProject Then
FileExtStr = ".xlsm": FileFormatNum = 52
Else
FileExtStr = ".xlsx": FileFormatNum = 51
End If
Case 56: FileExtStr = ".xls": FileFormatNum = 56
Case Else: FileExtStr = ".xlsb": FileFormatNum = 50
End Select
If anyone knows how I can amend the above to save as a PDF it would be greatly appriciated!!
The original code came from Microsoft's website:
Using VBA in Excel to Send Workbooks and Ranges Through E-Mail with Outlook (Part 1 of 2)
The exact bit i've used is under the heading 'Mailing Single Sheets as Attachments'
Thanks in advance,
Dan
I've came across a small problem whilst writing my latest bit of VBA..
I have the below code which select the file format when sending a document through Outlook, however i want to send this document as a PDF.
I've tried amending the file extension to .pdf to no avail...
It does send as a PDF but it won't open the document, the error message is saying it's in the wrong file format
Select Case Sourcewb.FileFormat
Case 51: FileExtStr = ".xlsx": FileFormatNum = 51
Case 52:
If .HasVBProject Then
FileExtStr = ".xlsm": FileFormatNum = 52
Else
FileExtStr = ".xlsx": FileFormatNum = 51
End If
Case 56: FileExtStr = ".xls": FileFormatNum = 56
Case Else: FileExtStr = ".xlsb": FileFormatNum = 50
End Select
If anyone knows how I can amend the above to save as a PDF it would be greatly appriciated!!
The original code came from Microsoft's website:
Using VBA in Excel to Send Workbooks and Ranges Through E-Mail with Outlook (Part 1 of 2)
The exact bit i've used is under the heading 'Mailing Single Sheets as Attachments'
Thanks in advance,
Dan