VBA Create Folder

CarlStephens

Board Regular
Joined
Sep 25, 2020
Messages
128
Office Version
  1. 2016
Platform
  1. Windows
Hello All,

I have the below code that create a folder in a path as directed which pulls the information from cells F1 and F3 n the spreadsheet, and I want to change directory path to my One Drive. Can someone guide me as to what the code should look like to include my One Drive address. Thank you

One Dive Address:

Current code:
Sub NewFolder()
'
If Len(Dir([F3] & [F1], vbDirectory)) = 0 Then
MkDir [F3] & [F1]
MsgBox "Folder created in location"
Else
MsgBox "Folder already exists!"
End If
End Sub
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Dir is not able to access sharepoint
 
Upvote 0
Your OneDrive should have a dedicated folder in your pc where whatever is placed there syncs to OneDrive.
Set that as your destination folder.
 
Upvote 0
Your OneDrive should have a dedicated folder in your pc where whatever is placed there syncs to OneDrive.
Set that as your destination folder.
Thank you. I have the address, but what do I need to amend on the code?
 
Upvote 0

Forum statistics

Threads
1,215,836
Messages
6,127,183
Members
449,368
Latest member
JayHo

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