Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() My below code is bombing on the next to last line "Thisworkbook.SaveAs..." Can anyone spot my problem?, please. TIA Sub Writingfilenames() Dim foldername As String Dim Filename As String foldername = Sheets("ADSS-01").Name If Not FolderExists(foldername) Then MkDir foldername Filename = Sheets("ADSS-01").Cells(3, 4) ThisWorkbook.SaveAs Filename:="C:\My Documents\" & foldername & "\" & Filename & ".xls" End Sub '----------------------------------------------------------------- Function FolderExists(Folder) As Boolean '----------------------------------------------------------------- Dim sFolder As String On Error Resume Next sFolder = Dir(Folder, vbDirectory) If sFolder < "" Then If (GetAttr(sFolder) And vbDirectory) = vbDirectory Then FolderExists = True End If End If End Function |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Create Folder Using VBA | Excel Discussion (Misc queries) | |||
Create Folder and Text File in folder | Excel Programming | |||
Create a Folder | Excel Programming | |||
Create Folder | Excel Programming | |||
Create Folder / Copy Folder / Replace | Excel Programming |