Ron's Email code not working for me

justme

Well-known Member
Joined
Aug 26, 2002
Messages
724
Code:
 TempFilePath = Environ$("temp") & "\"
 TempFileName = UserName & (wb1.Name)
 FileExtStr = "." & LCase(Right(wb1.Name, Len(wb1.Name) - InStrRev(wb1.Name, ".", , 1)))


FileExtStr = "." & LCase(Right(wb1.Name, Len(wb1.Name) - InStrRev(wb1.Name, ".", , 1)))

This is a line of code from Ron de Bruins site. I can not figure out what it is saying, but I think it is the line of code which is naming the extension of a temporary file before emailing it. I am getting an error because the file is coming back with two .xls.xls extensions and it is going to the quarantine folder.

Question 2:
Another line of code reads
TempFileName = UserName & (wb1.Name)

I understand this to mean that the name of the attachment should be the username plus the name of the workbook, but what I am actually getting is the name of the workbook minus the very first letter of the name of the workbook plus .xls.xls

So, I am expecting to see

MyName ActiveWorkbook Name.xls

I am seeing
ctiveWorkbook Name.xls.xls
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.

Forum statistics

Threads
1,181,055
Messages
5,927,862
Members
436,573
Latest member
CMR237

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
Top