SaveAs method not working properly

mlk5132

New Member
Joined
Oct 27, 2011
Messages
1
Long story short I have a program written that once the user clicks submit, an email is generated a sent attaching the excel file they were creating. This is all done in the background as they will be working on a form. I have the program saving a local copy of the .xls file to their WINDOWS\TEMP folder so the email can later attach it. The problem that I'm running in to is that for some people's machines here at work, it isn't saving then generating an error when it later tried to attach a file that isn't there. There's no error regarding saving the file, it just doesn't actually do it. It works perfectly for some people, just not others.

Code:
PSday = Day(Date)
PSmonth = Month(Date)
PSyear = Year(Date)
PSyear = Right(PSyear, Len(PSyear) - 2)
 
PSpath = "C:\WINDOWS\Temp"
PSfilename = "PSCodeRequest_" & PSmonth & PSday & PSyear
PSfinal = PSpath & "\" & PSfilename
 
 
ChDir (PSpath)
ActiveSheet.SaveAs Filename:=PSfilename & ".xls", FileFormat:=56
 
PSfinal = PSfinal & ".xls"

Any help would be greatly appreciated, I haven't been able to make any headway on this problem.
 

Excel Facts

Show numbers in thousands?
Use a custom number format of #,##0,K. Each comma after the final 0 will divide the displayed number by another thousand

Forum statistics

Threads
1,202,915
Messages
6,052,535
Members
444,590
Latest member
GCLee

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