Capy_Uther
New Member
- Joined
- May 14, 2023
- Messages
- 16
- Office Version
- 365
- Platform
- Windows
Hello to everyone like the topic say i made a button that print the excel file on PDF and auto save with a name, for the auto name the file im using the next line::
NombreArchivo = Mid(CeldaNombre.Value, 9, InStr(1, CeldaNombre.Value, " ", vbTextCompare) - 1) & _
"_" & Format(Now, "ddmmyy_") & Mid(CeldaNombreA.Value, 1) & ".pdf"
As you can see for the name im using the CeldaNombre.Value variable to take the information froma cell on the excel
Im going to writte 2 examples:
1.- If that cell contains "Nombre: David Trujillo Gil" when i run that line it save the PDF with the name David T_Date.pdf What i can change on that line to auto save the line just with the fist name David_Date.pdf without the space and the T. And if that name changes i always want to auto save with the First Name and Date.
2.- I want to know how i can do the same thing but instead of first name take the 1st letter of all words and the date, using the same example Nombre: David Trujillo Gil then i want the auto save name the file DTG_Date.pdf
I hope some one can help me with this.
NombreArchivo = Mid(CeldaNombre.Value, 9, InStr(1, CeldaNombre.Value, " ", vbTextCompare) - 1) & _
"_" & Format(Now, "ddmmyy_") & Mid(CeldaNombreA.Value, 1) & ".pdf"
As you can see for the name im using the CeldaNombre.Value variable to take the information froma cell on the excel
Im going to writte 2 examples:
1.- If that cell contains "Nombre: David Trujillo Gil" when i run that line it save the PDF with the name David T_Date.pdf What i can change on that line to auto save the line just with the fist name David_Date.pdf without the space and the T. And if that name changes i always want to auto save with the First Name and Date.
2.- I want to know how i can do the same thing but instead of first name take the 1st letter of all words and the date, using the same example Nombre: David Trujillo Gil then i want the auto save name the file DTG_Date.pdf
I hope some one can help me with this.