Share via

Alert Debug

Anonymous
2025-03-14T09:25:20+00:00

Hi,

I receive following alert with the Debug command. What's wrong?

'TEMP map leegmaken

stPad = "W:\Kwaliteit\Dirk\ANALYSECERTIFICATEN\TEMP"

If Dir(stPad & "*.?*") < > "" Then

Kill (stPad & "*.*") Marked in yellow

Else

End If

Kind regards Heidi

Microsoft 365 and Office | Access | For business | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

1 answer

Sort by: Most helpful
  1. Anonymous
    2025-03-14T10:32:07+00:00

    What message do you receive?

    For one thing you don't need the brackets

    Dim stPad                 As String  
    'TEMP map leegmaken  
    stPad = "W:\Kwaliteit\Dirk\ANALYSECERTIFICATEN\TEMP\"  
    If Dir(stPad & "\*.?\*") &lt;&gt; "" Then  
        Kill stPad & "\*.\*"  
    Else  
    End If
    

    What exactly are you trying to do? Perhaps we can offer a better way to accomplish it.

    Not sure I understand what you're trying to do with "*.?*", why not simply "*.*" like in your Kill statement? If you're looking for files with extension, then I'd assume that's what you also want to delete, no? So I'd match my Dir() pattern with my Kill pattern normally, such as:

    Dim stPad                 As String  
    'TEMP map leegmaken  
    stPad = "W:\Kwaliteit\Dirk\ANALYSECERTIFICATEN\TEMP\"  
    If Dir(stPad & "\*.?\*") &lt;&gt; "" Then  
        Kill stPad & "\*.?\*"  
    Else  
    End If
    

    or

    Dim stPad                 As String  
    'TEMP map leegmaken  
    stPad = "W:\Kwaliteit\Dirk\ANALYSECERTIFICATEN\TEMP\"  
    If Dir(stPad & "\*.\*") &lt;&gt; "" Then  
        Kill stPad & "\*.\*"  
    Else  
    End If
    

    (sorry about the formatting the editor's code block is making the VBA all on one line so I had to use standard which remove all indenting)

    Was this answer helpful?

    1 person found this answer helpful.
    0 comments No comments