LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Ray Ray is offline
external usenet poster
 
Posts: 267
Default Mkdir with 2 variables not working ....

Hi -

I've got some code that I've used in a previous workbook that allows a
user to save a file to specified drive, using info from the file
itself to build the file path and name. The previous version of the
code (way below) only used one variable in building the path/name,
while the current one uses 2 variables -- the addition of the 2nd
variable appears to be causing the problem...

The code below is my most recent attempt at making this work -- I've
already tried a bunch of different variations of the code:

Private Sub SubmitFcst_Click()
Dim Drive As Long
Dim Path As String, Per As String, Bus As String, NewPath As
String
Dim Store As String, NewFile As String, NewPath2 As String

Store = Format(Sheets("Dashboard").Range("E13").Value, "000")
Bus = Sheets("Dashboard").Range("J15").Value
Per = Sheets("Dashboard").Range("i5").Value
Path = "\\....\Store Forecasts\FY08\" 'actual code specifies
entire drive path
NewPath = Path & Per & "\"
NewPath2 = NewPath & Bus & "\"
NewFile = NewPath2 & "Forecast_" & Bus & Store & "_" & Per &
".xls"

' <misc code used to verify user's intent to save remotely and ensure
all necessary info is entered

'Make folder to hold new Forecast file
If Dir(NewPath2, vbDirectory) = "" Then MkDir NewPath2
' the line above gives an Error 76: unable to find
specified path, with the Mkdir code highlighted ... I also tried MkDir
(NewPath2) ...


ORIGINAL code:
If Dir(Path & Per, vbDirectory) = "" Then MkDir (Path & Per)

Is there a limit to how many variables can be used in building the
filename?

All help is greatly appreciated ....

//ray

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
sumproduct/sum not working with multiple variables Nelson Excel Worksheet Functions 10 June 10th 09 03:49 AM
mkdir Peter[_61_] Excel Programming 2 May 12th 07 12:48 PM
MKDir not working Robert_L_Ross Excel Programming 3 June 30th 06 07:17 AM
mkdir problem Tom Ogilvy Excel Programming 2 August 31st 04 03:22 PM
MkDir error Eric Excel Programming 3 May 17th 04 08:58 PM


All times are GMT +1. The time now is 10:39 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"