ThisWorkbook.Path

  • Thread starter Thread starter Birdy
  • Start date Start date
B

Birdy

I have the following problem.

I want to save the active workbook and make an empty backup in the same
directory.
Code works nice, but only once.
Next execute of code the default dir of windows is used and creates a
problem.

Sub opslaan_evenement()
'
' save_event Macro
' write empty backup as "AWR leeg" in same dir
'

naam2 = Cells(1, 1)
naam3 = ThisWorkbook.Path
naam4 = naam3 + "\" + naam2

Application.DisplayAlerts = False
ActiveWorkbook.SaveAs (naam4)
Sheets(1).Select
Range("C7:F357").Select
Selection.ClearContents
ActiveWorkbook.SaveAs ("AWR leeg")
Application.DisplayAlerts = True
'
End Sub


Mayby someone can help me !
 
With your code

ActiveWorkbook.SaveAs ("AWR leeg")

you need to supply a path as well or change to that directory befor
saving

eg

ActiveWorkbook.SaveAs (thisworkbook.path & "\AWR leeg"
 
Back
Top