Results 1 to 4 of 4

Directory not exist

Threaded View

  1. #1
    Forum Contributor
    Join Date
    09-21-2015
    Location
    nederland
    MS-Off Ver
    2021
    Posts
    204

    Directory not exist

    Please help,

    when I change the name of directory on Sheets("Settings").Range("F4")

    I get error directory is not exist, I need to create directory manual, below VBA is working if the directory not change,

    it's possible to add vba if directory not exist wil be create automaticaly.


    Thank you


    Sub OpslaanOverzichtalsPDF()
    
    
    Dim WYN As Worksheet
    Dim rngID As Range
    Dim rngListStart As Range
    Dim rowsCount As Long
    Dim i As Long
    
    
    Dim dsh As Worksheet
    Dim tsh As Worksheet
    Dim setting_Sh As Worksheet
    Dim File_Name As String
    
    Application.ScreenUpdating = False
    
    Set dsh = ThisWorkbook.Sheets("Aanmaning")
    Set setting_Sh = ThisWorkbook.Sheets("Settings")
    Set WYN = ActiveWorkbook.Sheets("Aanmaning")
    
    
    Set rngID = WYN.Range("K2")
    
    
    Set rngListStart = WYN.Range("W2")
    
    rowsCount = rngListStart.CurrentRegion.Rows.Count - 1
    
    For i = 1 To rowsCount
     
        rngID.Value = rngListStart.Offset(i - 1, 0).Value
        
       File_Name = setting_Sh.Range("F5").Value & " - " & dsh.Range("K2").Value & ".pdf"
        dsh.ExportAsFixedFormat xlTypePDF, ThisWorkbook.Sheets("Settings").Range("F4").Value & "\" & File_Name
        
        
    
    Next i
    
    Application.ScreenUpdating = True
    
    End Sub
    Last edited by kirana2014; 10-12-2023 at 12:58 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Check if a file exist in directory with excel
    By biroulcontabil in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 04-24-2017, 11:49 AM
  2. Search from a list of hyperlink if the file exist then select the path as directory
    By jiaweilee in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-27-2016, 12:03 AM
  3. Check if files (300+) exist in directory
    By uncleslinky in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 03-01-2011, 12:04 PM
  4. Create new directory if it doesn't exist and save sheet
    By rkjudy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-01-2011, 01:47 PM
  5. Check if Directory Exist
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-02-2008, 03:32 PM
  6. [SOLVED] Save to directory and create if not exist
    By Rob in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-29-2005, 02:06 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1