ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   exporting a worksheet for backup (https://www.excelbanter.com/excel-programming/306447-exporting-worksheet-backup.html)

sp00nix[_13_]

exporting a worksheet for backup
 
I would like to export the last worksheet in my workbook into a backu
dir. How can I do this without doing "Copy Worksheet" where it opens u
in the new work book? I would just like it to export while keeping onl
the current workbook open.
Thanks in advance,
Mik

--
Message posted from http://www.ExcelForum.com


steve

exporting a worksheet for backup
 
this dose not do exactly what your asking, it saves the
whole file to a bu directory, adjust it to fit your needs

Sub CreateBackUp()
'need to creat the folder Bu if not their
Dim Num As Integer
Dim OrgPathSt As String
Const BUPath As String = "C:\BU\"
Dim BUPathName As String
Dim Wb As Workbook

On Error GoTo CreateDir
Application.ScreenUpdating = False

Set Wb = ActiveWorkbook

OrgPathSt = Wb.Path & "\" & Wb.Name
If Left(OrgPathSt, 1) = "\" Then
MsgBox "You must name & save your file first,
Via 'File' then 'Save As'"
Exit Sub
End If
BUPathName = "C:\BU\" & Left(Wb.Name, Len(Wb.Name) -
4) & _
" (" & Year(Date) & "-" & Month(Date) & "-" & Day
(Date) & " " & Hour(Time) & "." & Minute(Time) & "." &
Second(Time) & ")" & ".xls"

Num = MsgBox("Do you wish to save the Current file
as:" & vbNewLine & "[ " & OrgPathSt & " ]" _
& vbNewLine & vbNewLine & "And Create the Backup
File:" & vbNewLine & "[ " & BUPathName & " ]",
vbOKCancel, "Back Up")
If Num = vbCancel Then Exit Sub

Wb.Save
SaveAsBu:
Wb.SaveAs FileName:=BUPathName
Wb.Close

Workbooks.Open FileName:=OrgPathSt

Application.ScreenUpdating = True
Exit Sub
CreateDir:
MkDir "BU"
GoTo SaveAsBu
End Sub

Tom Ogilvy

exporting a worksheet for backup
 
I doubt you can, but you can make the action not visible

Application.ScreenUpdating = False
worksheets(worksheets.count).Copy
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs "C:\myfolder\myfile.xls"
Application.DisplayAlerts = True
ActiveWorkbook.Close SaveChanges:=False
Application.ScreenUpdating = True

--
Regards,
Tom Ogilvy

"sp00nix " wrote in message
...
I would like to export the last worksheet in my workbook into a backup
dir. How can I do this without doing "Copy Worksheet" where it opens up
in the new work book? I would just like it to export while keeping only
the current workbook open.
Thanks in advance,
Mike


---
Message posted from http://www.ExcelForum.com/




sp00nix[_14_]

exporting a worksheet for backup
 
Thanks, I have made similar code but my original question kind of
stumped me. Anyone have any other ideas?
Mike


---
Message posted from http://www.ExcelForum.com/


sp00nix[_15_]

exporting a worksheet for backup
 
One reason I didn't want to copy the ws to a new wb is because it won'
copy the complete cell if it has more than 255 chars. Is there any wa
around this issue? Thank

--
Message posted from http://www.ExcelForum.com


Tom Ogilvy

exporting a worksheet for backup
 
Dim rng as Range
Application.ScreenUpdating = False
set rng = worksheets(worksheet.count).Cells
worksheets(worksheets.count).Copy
rng.copy Destination:=Activesheet.Cells
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs "C:\myfolder\myfile.xls"
Application.DisplayAlerts = True
ActiveWorkbook.Close SaveChanges:=False
Application.ScreenUpdating = True

--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
I doubt you can, but you can make the action not visible

Application.ScreenUpdating = False
worksheets(worksheets.count).Copy
Application.DisplayAlerts = False
ActiveWorkbook.SaveAs "C:\myfolder\myfile.xls"
Application.DisplayAlerts = True
ActiveWorkbook.Close SaveChanges:=False
Application.ScreenUpdating = True

--
Regards,
Tom Ogilvy

"sp00nix " wrote in message
...
I would like to export the last worksheet in my workbook into a backup
dir. How can I do this without doing "Copy Worksheet" where it opens up
in the new work book? I would just like it to export while keeping only
the current workbook open.
Thanks in advance,
Mike


---
Message posted from http://www.ExcelForum.com/






Don Guillett[_4_]

exporting a worksheet for backup
 
One way might be to delete all but the last worksheet and saveas

--
Don Guillett
SalesAid Software

"sp00nix " wrote in message
...
I would like to export the last worksheet in my workbook into a backup
dir. How can I do this without doing "Copy Worksheet" where it opens up
in the new work book? I would just like it to export while keeping only
the current workbook open.
Thanks in advance,
Mike


---
Message posted from
http://www.ExcelForum.com/





All times are GMT +1. The time now is 07:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com