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

shoun2502

New Member
Joined
Nov 14, 2018
Messages
43
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

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Jaafar Tribak

Well-known Member
Joined
Dec 5, 2002
Messages
8,203
Office Version
  1. 2016
Platform
  1. Windows
Do you have the folder paths stored in cells in the personal workbook ?
 

Tupe77

Board Regular
Joined
Nov 26, 2020
Messages
97
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Change Thisworkbook.Activesheet to Activeworkbook.activeksheet

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

Watch MrExcel Video

Forum statistics

Threads
1,130,120
Messages
5,640,234
Members
417,131
Latest member
Seanr19871

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
Top