Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
The following code creates the file for the workbook. I need to be able to
disable a form button if the person has a file open, lets say #4 and file #5 exists I do not want them to be able to create another workbook from file #4 they would have to open #5. myParentFolder = "C:\" On Error Resume Next MkDir myParentFolder & mycsj MkDir myParentFolder & mycsj & "\Pay Reports" MkDir myParentFolder & mycsj & "\Pay Reports" & "\" & Range("name") On Error GoTo 0 myFolder = myParentFolder & mycsj & "\Pay Reports" & "\" & Range("name") i = 1 myFileName = Range("file") While Dir(myFolder & "\" & myFileName & " " & i & ".xls") < "" i = i + 1 Wend myFileName = myFolder & "\" & myFileName & " " & i & ".xls" ActiveWorkbook.SaveAs Filename:= _ myFileName, FileFormat:=xlNormal, _ Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _ CreateBackup:=False MsgBox "File Saved to " & myFileName End If |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
does file exist | Excel Programming | |||
Command Line. How to tell to XL : If the xls file exist : Open it, if it does not exist : Create it. | Excel Programming | |||
Does File Exist | Excel Programming | |||
File does not exist | Excel Programming | |||
does a file exist? | Excel Programming |