Saved file output not as i expected

ipbr21054

Well-known Member
Joined
Nov 16, 2010
Messages
5,226
Office Version
  1. 2007
Platform
  1. Windows
Hi,
In my code the pdf file is saved using this partial piece of code.
Rich (BB code):
& .Range("B3").Value & " " & .Range("AB1").Value & " " & Format(.Range("E3").Value, "dd-mm-yyyy") & ".pdf"

The saved test file for the above is saved like so
JOE BLOGGS
195ACB
24-10-2023.pdf


Im trying to change the date & ref number around so it looks like this
JOE BLOGGS
24-10-2023
195ACB.pdf

So i used this line of code to replace the original.

Rich (BB code):
& .Range("B3").Value & " " & Format(.Range("E3").Value, "dd-mm-yyyy")& .Range("AB1").Value & " " & ".pdf"

But the output is saved like so
JOE BLOGGS
24-10-2023195AC
B.pdf

Do you see why please.
Thanks
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
You have a space ("& " " &") between the first and second values but not before the second and third values. Try below...

VBA Code:
& .Range("B3").Value & " " & Format(.Range("E3").Value, "dd-mm-yyyy") & " " & .Range("AB1").Value & ".pdf"

I hope that helps,

Doug
 
Upvote 0
Solution

Forum statistics

Threads
1,215,091
Messages
6,123,062
Members
449,089
Latest member
ikke

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