PDA

View Full Version : excel 2007 stop pop up



Emoncada
09-25-2008, 12:16 PM
I have this code that worked great, but now it's giving me a cannot find file. It's supposed to look to see if the file is there if not then just create it without a pop up. This is now in Excel 2007 is there a way I can prevent this pop up?

Bob Phillips
09-25-2008, 12:22 PM
And what code is that?

Emoncada
09-25-2008, 12:24 PM
forgot the code that would help.

Sub SaveAs()
Dim strFilepath As String
Dim strSaveAsFile As String, fp As String
Dim res As String
Dim wb As Workbook

strFilepath = "S:\Depot (file://\\apex-dc05\orlando\Depot) Outgoing 2008\" & _
Format(Date, "yyyy") & "\" & _
Format(Date, "mmmm yyyy") & "\" & _
Format(Date, "mmm dd") & "\"
Call MakeFolders(strFilepath)

res = InputBox("What Are Your Initials", "Save Your PS Pim")
strSaveAsFile = "Pim " & (Format(Date, "mm.dd.yy ")) & res & ".xls"
On Error Resume Next
Set wb = Workbooks.Open(strFilepath & strSaveAsFile)
On Error GoTo 0
If wb Is Nothing Then
Set wb = ActiveWorkbook
wb.SaveAs strFilepath & strSaveAsFile, xlWorkbookNormal
End If

End Sub

Bob Phillips
09-25-2008, 02:55 PM
Did I give you this code, it looks familiar?

It all works fine for me in XL2007. Creates a 97-2003 type file, but works.

Emoncada
09-25-2008, 02:58 PM
It works but it gives me a popup saying can't find file name once you click ok it goes and creates it. I wanted to know if I can avoid the pop up where the user needs to click ok?

Bob Phillips
09-25-2008, 05:07 PM
I doesn't give me the popup, and it is coded not too.

Emoncada
09-26-2008, 05:21 AM
Then I don't understand why it's giving the pop up.

Emoncada
09-26-2008, 05:26 AM
It the other part of the code be causing the pop up?

Private Sub MakeFolders(fp As String)
Dim Dirs As Variant
Dim tmpDir As String
Dim i As Long

Dirs = Split(fp, "\")
tmpDir = Dirs(0) & Application.PathSeparator
On Error Resume Next
For i = LBound(Dirs) + 1 To UBound(Dirs)

tmpDir = tmpDir & Dirs(i) & Application.PathSeparator
MkDir tmpDir
Next i
End Sub