VB Save

C

Craig Coope

I have a activeworkbook.save in my code after a command button is
pressed but as far as I can tell it doesn't actually perform the save
until I close my forms...Is this normal?

All I want is sheet one to be saved every time the "job end" button is
pushed so that if the pc crashes all the data is up-to-date when I
reboot...

Craig...
 
E

Earl Kiosterud

Craig,

It should save the workbook when the code is executed. Maybe you should ensure the code is
in fact being executed. Maybe a breakpoint (F9) on the line.
--
Earl Kiosterud
www.smokeylake.com

Note: Some folks prefer bottom-posting. But if you bottom-post to a reply that's already
top-posted, the thread gets messy. When in Rome...
 
D

Don Guillett

This is one I use

Sub Backup() 'kept in personal.xls & assigned to toolbar button
On Error GoTo BackupFile
MkDir CurDir & "\Backup"
BackupFile:
With ActiveWorkbook
MyWB = .Path & "\BACKUP\" & .Name
.SaveCopyAs MyWB
.Save
End With
End Sub
 
C

Craig Coope

This is one I use

Sub Backup() 'kept in personal.xls & assigned to toolbar button
On Error GoTo BackupFile
MkDir CurDir & "\Backup"
BackupFile:
With ActiveWorkbook
MyWB = .Path & "\BACKUP\" & .Name
.SaveCopyAs MyWB
.Save
End With
End Sub

Thanks to both of your advice...I sorted it out...

I had something like...

userform1.hide
userform2.show
activeworkbook.save

Which didn't really work as I wanted so I had to move the save up
one....
 
Top