PDF Runtime error

ashani

Active Member
Joined
Mar 14, 2020
Messages
345
Office Version
  1. 365
Platform
  1. Windows
Hi,
In my worksheet - I have an option for the activesheet to be converted in PDF and send email. However, everytime I click on email button I get the following error message :

Run-time error '02147028494(80070002);'
Cannot find this file. Verify the path and file name are correct.

That's only happen in Office 2013 version but when I use the same file in Office 365 - it works fine. The problem is I don't have Office 365 so is there anything we can do for this run in Office 365 as well as any other version.

Here is the code for PDF Conversion :

VBA Code:
  PdfFile = Sheets("Test").Range("S10").Value & "_" & Sheets("Test").Range("B3").Value
  i = InStrRev(PdfFile, ".")
  If i > 1 Then PdfFile = Left(PdfFile, i - 1)
  PdfFile = PdfFile & "_" & ".pdf"

Please can someone guide me on this.

Many thanks,
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
You said that you have already verified path and name but add this 'MsgBox' to your code and, firstly, see if path and filename really matches the location and name of the file to be sent by email and secondly, check what information you are passing to the code that is sending the mail.
VBA Code:
pdffile = pdffile & "_" & ".pdf"
MsgBox pdffile
 
Upvote 0
hi @rollis13
thank you for the reply.
I tried that and it's only coming up with the actual file name, no path name or location of the file. How can I change/amend it?
Thanks,
 
Upvote 0
Can't be of much help since I have non idea on how your vbe project is organized but all you have to do is add before 'pdffile' its path.
If the path is static you could use: pdffile = "C:\username\foldername\" & pdffile & ".pdf"
 
Upvote 0

Forum statistics

Threads
1,214,954
Messages
6,122,462
Members
449,085
Latest member
ExcelError

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top