Ron's Email code not working for me

justme

Well-known Member
Joined
Aug 26, 2002
Messages
729
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

Quick Sum
Select a range of cells. The total appears in bottom right of Excel screen. Right-click total to add Max, Min, Count, Average.

Forum statistics

Threads
1,214,991
Messages
6,122,628
Members
449,095
Latest member
bsb1122

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