The error occured in this program after I changed to option explicit
and got rid of all the dollar signs and percent signs and switched to 10 or 12 character variables as showed in MSB Exaples!!
Public Sub CreateDir()
Drv = App.Path
ChDir Drv
Select Case intRegg
Case 1
Message box Placed Here showed the correct Path was Chosen so why did I get this stupid error?
Flow = Drv + "\CHXPLUS1"
MkDir Flow
Case 2
Flow = Drv + "\CHXPLUS2\"
MkDir Flow
Case 3
Flow = Drv + "\CHXPLUS3\"
MkDir Flow
Case 4
Flow = Drv + "\CHXPLUS4\"
MkDir Flow
Case 5
Flow = Drv + "\CHXPLUS5\"
MkDir Flow
Case 6
Flow = Drv + "\CHXPLUS6\"
MkDir Flow
Case Else
End Select
WriteFiles 1, 1, 0
Back2_3 4
End Sub

Okay, let first start by reminding you of code tags...

Then let me say where are you getting this error? What line and what are the state of your variables?

Next up is how do you add, i.e. the use of addition, two string together? (Sarcastic, yes, I know). But in reality you concatinate two string together by the use of the ampersand character (&)...

String1 = String1 & String2

Another thing I noticed is in the first case you have "\path" but in the second and thereafter cases you have "\path\"

Public Sub CreateDir()
Drv = App.Path
If Right(Drv, 1) = "\" Then Drv = Left(Drv, Len(Drv) - 1) 'chop off any trailing back slash as you have seemed to include it below in your code so as to avoid a double backslash in the path "\\"
ChDir Drv
Select Case intRegg
Case 1 
  Flow = Drv [b]&[/b] "\CHXPLUS1"
Case 2
  Flow = Drv [b]&[/b] "\CHXPLUS2"
Case 3
  Flow = Drv [b]&[/b] "\CHXPLUS3"
Case 4
  Flow = Drv [b]&[/b] "\CHXPLUS4"
Case 5
  Flow = Drv [b]&[/b] "\CHXPLUS5"
Case 6
  Flow = Drv [b]&[/b] "\CHXPLUS6"
End Select
MkDir Flow
WriteFiles 1, 1, 0
Back2_3 4
End Sub

Also, I removed all of your mkdir statements since the select case is only used to build the path and put the mkdir statement after the select case to shorten your code.

Then I removed your case else as you had no code there so no need for the case else.

Now, finally, if you are using this code on vista then that is your problem as the C:\Program Files\AppName folder is protected. Please see this thread...

http://www.vbforums.com/showthread.php?p=2807202#post2807202

for changes you need to make to your program.

Good Luck

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.