Excel VBA writing a VB script file (Problem with MkDir Command

MPW

Well-known Member
Joined
Oct 7, 2009
Messages
571
Office Version
  1. 365
Platform
  1. Windows
Hello.

I am using using VBA to create a VB script file that will create folders and copy files.

Everything was running great until I tried to use the MkDir command.
Here is the VBA Command followed by how it appears in the VB script.
Code:
macfile.Write ("     MkDir(""" & dest & "\" & stk & "_" & bkd & "_" & bkn & "_" & chp & """)" & vbCrLf)     'VBA Code

                     MkDir("G:\Projects\N1_Spanish\N1_HDH_SHJ_6_Sessions\N2_ESS_WYI_001_MAT_001")     'VB script command
The folder "G:\Projects\N1_Spanish\N1_HDH_SHJ_6_Sessions" already exists.

I know that this board is for Excel issues and not VB Script, but since I am using Excel to create this I thought I would give it a try. If I have violated the scope of the forum I will be happy to withdraw the question.
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).
I finally dug this up and it answered my issue.
Code:
                    macfile.Write ("     Set oFSO = CreateObject(""Scripting.FileSystemObject"")" & vbCrLf)
                    macfile.Write ("     oFSO.CreateFolder """ & dest & "\" & stk & "_" & bkd & "_" & bkn & "_" & chp & """" & vbCrLf)
 
Upvote 0
Solution

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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