hi can u guys help me i try to print PDF from wb in the folder my code giving this error thaks in advance .
Option Explicit
Sub aaa()
     
    Dim xRow As Long
    Dim Path, Fname, InitialFoldr$
     Dim nName As String, ndir, strPDFName, fileSaveName
     Dim wkb As Workbook
     Dim ws As Worksheet
                           Dim dlater As String, getwbn

     
    InitialFoldr$ = "D:\" '
     
    With Application.FileDialog(msoFileDialogFolderPicker)
        .InitialFileName = Application.DefaultFilePath & "\"
        .Title = "Please select a folder to list Files from"
        .InitialFileName = InitialFoldr$
        .Show
        If .SelectedItems.Count <> 0 Then
            Path = .SelectedItems(1) & "\"
            Fname = Dir(Path, 7)
            
               Fname = Dir(Path & "\*.xlsx", vbNormal)
       getwbn = Fname
       dlater = Left(getwbn, 9)
       nName = dlater
       ndir = "D:\1\" & nName & "\"
     If Dir(ndir, vbDirectory) = "" Then MkDir ndir


            Do While Fname <> ""
                
                       Set wkb = Workbooks.Open(FileName:=Path & "\" & Fname)
 
   For Each ws In wkb.Worksheets
         
      strPDFName = ws.Name
      
      fileSaveName = ndir & ws.Name
      ws.ExportAsFixedFormat Type:=xlTypePDF, FileName:=fileSaveName, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False  ', PageSetup.Orientation = xlLandscape
   Next ws
       wkb.Close False

                Fname = Dir
            Loop
        End If
    End With
End Sub