Problem VBA REPLACE FUNCTION

IGORR

New Member
Joined
Apr 24, 2015
Messages
6
Good morning;

I need the help o somebody with the following code.

The error is "Argument not valid".

Sub PrintPDFServ() '*****Imprimir sin visualizacion*****
Application.ScreenUpdating = False
'Para Crear archivos PDF Desde Excel nada mas tienes que instalar el complemeto para guardar archivos pdf de Oficce
Dim sDate
sName = Replace(Sheets("Ficha Tecnica Serv").Range("E6"), ".", "_")
sDescrip = Replace(Sheets("Ficha Tecnica Serv").Range("E8"), ".", "_")
Set sDate = Sheets("Ficha Tecnica Serv").Range("I6")
XName = sName & "-" & sDescrip & " (" & Format(sDate, "ddmmyyyy") & ")"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
"\\SERVIDORVELL\docs\Ejea\Calidad\Especificaciones\Especificaciones Tecnicas Materiales\Papel\Fichas Tecnicas de Papel\Definitivo\" & XName & ".pdf", _
Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
Application.ScreenUpdating = True
End Sub

Thanks in advance.
 
Th problem is other.

Excell has a limit of characterest with the path and the name included of 216 characteres.

In the example the path is so long.

Anyway the changes you have proposed works.

Many thanks
 
Upvote 0

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Forum statistics

Threads
1,215,334
Messages
6,124,323
Members
449,154
Latest member
pollardxlsm

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