In reply to Stab.

Here's what I would do. Note that I removed quotes from the macro variables and quoted in the statement syntax instead.

%Let path = C:\temp\dirname;
%Let xlsxfile = test.xlsx;

options dlcreatedir;
libname folder "&path.";
libname folder clear;

data cars;
set sashelp.cars;
run;

proc export
data = cars
outfile = "&path./&xlsxfile."
dbms= xlsx REPLACE;
Sheet = "Success";
run;