Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have a Packing list on Sheet1,inventory Sheet2 and Customer info
Sheet3. Sheet1 linked and formulated to pull data from sheet2 and sheet3. I added save botton to save each packing list to another folder(C:\Paking_List06) I would like to know how to write a VBA code to export Sheet 1 to packing list folder. Thanks |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Give this a try:
Sub ExportSheet() ' Macro 6/30/2006 by Jamie Hildebrand ' '''''''''''''''''''''''''''''' 'PLACE DESIRED DESTINATION HERE FilePath$ = "C:\Parking_List06\" ''''''''''''''''''''''''''''''' 'THIS FORMATS THE FILE WITH THE 'CURRENT DATE FOLLOWED WITH THE 'TEXT "_Parking_Export.xls" FileName$ = Format(Date, "MMDDYY") & "_Parking_Export.xls" If Dir(FilePath$ & FileName$) < "" Then response = MsgBox("That file already exists. Do you want to overwrite it?", vbYesNo) If response < vbYes Then response = Trim(InputBox("Edit this name to prevent overwriting old file.", "Change Name", FileName$)) If response = "" Then MsgBox "You didn't enter anything.": Exit Sub FileName$ = response Else Kill FilePath$ & FileName$ End If End If Sheets("Sheet1").Copy ActiveWorkbook.SaveAs FileName:=FilePath$ & FileName$ ActiveWorkbook.Close MsgBox "Export Finished", vbInformation, "Status" End Sub Regards, Jamie wrote: I have a Packing list on Sheet1,inventory Sheet2 and Customer info Sheet3. Sheet1 linked and formulated to pull data from sheet2 and sheet3. I added save botton to save each packing list to another folder(C:\Paking_List06) I would like to know how to write a VBA code to export Sheet 1 to packing list folder. Thanks |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thank you I am working on it.
jseven wrote: Give this a try: Sub ExportSheet() ' Macro 6/30/2006 by Jamie Hildebrand ' '''''''''''''''''''''''''''''' 'PLACE DESIRED DESTINATION HERE FilePath$ = "C:\Parking_List06\" ''''''''''''''''''''''''''''''' 'THIS FORMATS THE FILE WITH THE 'CURRENT DATE FOLLOWED WITH THE 'TEXT "_Parking_Export.xls" FileName$ = Format(Date, "MMDDYY") & "_Parking_Export.xls" If Dir(FilePath$ & FileName$) < "" Then response = MsgBox("That file already exists. Do you want to overwrite it?", vbYesNo) If response < vbYes Then response = Trim(InputBox("Edit this name to prevent overwriting old file.", "Change Name", FileName$)) If response = "" Then MsgBox "You didn't enter anything.": Exit Sub FileName$ = response Else Kill FilePath$ & FileName$ End If End If Sheets("Sheet1").Copy ActiveWorkbook.SaveAs FileName:=FilePath$ & FileName$ ActiveWorkbook.Close MsgBox "Export Finished", vbInformation, "Status" End Sub Regards, Jamie wrote: I have a Packing list on Sheet1,inventory Sheet2 and Customer info Sheet3. Sheet1 linked and formulated to pull data from sheet2 and sheet3. I added save botton to save each packing list to another folder(C:\Paking_List06) I would like to know how to write a VBA code to export Sheet 1 to packing list folder. Thanks |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
The SAVE AS button does not show save to G: drive | New Users to Excel | |||
Command Button Save As Application.ExecuteExcel4Macro ("SAVE.AS?() | Excel Discussion (Misc queries) | |||
How to diasble save and save as menu but allow a save button | Excel Programming | |||
how to get disk icon on save button of save as dialog like 2000 | Excel Discussion (Misc queries) | |||
save button in excel to save one of the worksheets with a cell value as its name | Excel Programming |