The code doesn't Run when saved in Personal.Xlsb for creating folders.

shoun2502

New Member
Joined
Nov 14, 2018
Messages
45
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Dear Team,

I have the following codes as mentioned below which works fine when Running in Macro Enabled Work book but my Objective is to run these subroutine as mentioned below with Personal.xlsb and Saving it as Macro free workbook . The code are as follows

The code creates folder and Subfolder in the Directory
1st
VBA Code:
Function Folder_Existence(Mypath As String) As Boolean

Application.Volatile

If VBA.Dir(Mypath, vbDirectory) = "" Then
    Folder_Existence = False
Else
    Folder_Existence = True
End If

End Function

2nd

VBA Code:
Sub CreateMultipleFolder()

Dim sh As Worksheet
Set sh = ThisWorkbook.ActiveSheet
Dim sub_folder_path As String

Dim i As Integer

For i = 4 To sh.Range("I" & Application.Rows.Count).End(xlUp).Row
        
 sub_folder_path = sh.Range("C1").Value & Application.PathSeparator & sh.Range("I" & i).Value
 
    
    If Dir(sub_folder_path, vbDirectory) = "" Then
    
        MkDir (sub_folder_path)
        
        sh.Range("K" & i).Value = "Created"
    Else
        sh.Range("K" & i).Value = "Available"
    End If
     

Next i


End Sub

I would appreciate if these code are saved in my personal.xlsb and can use it for future reference without saving any Independent Macroenabled workbook

Thanks
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Do you have the folder paths stored in cells in the personal workbook ?
 
Upvote 0
Change Thisworkbook.Activesheet to Activeworkbook.activeksheet

The Personal Workbook does not contain that Activeworksheet, it is in another workbook.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,323
Members
452,635
Latest member
laura12345

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