Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default 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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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/



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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/

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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/





Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Searching worksheet and exporting name to other sheet OshawaChris Excel Discussion (Misc queries) 1 December 20th 08 04:47 PM
Exporting into a Worksheet Paul Peterson - Velox Consulting, LLC Excel Discussion (Misc queries) 7 October 22nd 08 01:47 PM
exporting worksheet to access Judy Margo Excel Discussion (Misc queries) 2 November 27th 06 04:49 PM
exporting excel worksheet to word morrowkd Links and Linking in Excel 1 May 5th 05 01:05 PM
why there is a backup copy for excel worksheet? zakko Excel Discussion (Misc queries) 1 April 14th 05 04:07 PM


All times are GMT +1. The time now is 12:11 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"