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

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.

Forum statistics

Threads
1,224,823
Messages
6,181,178
Members
453,021
Latest member
Justyna P

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