Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Using Excel 2007 and Win XP;
I run a VBA program that sets up several sheets. Now I want to code a distribution program that copies two of the sheets, one called "Find" and another called "REQ" from the "program file" into a new file, then copy that file out to three different network locations for users to view/use. Any assistance/shortcuts you could offer in the code to do this would be most appreciated. Thanks in advance. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Something like the following should help (you will need to set the network
locations): Sub DistributeSheets() Dim wkbNew As Workbook Dim strNetworkLocation1 As String Dim strNetworkLocation2 As String Dim strNetworkLocation3 As String 'Set location strNetworkLocation1 = "D:\1\test.xls" strNetworkLocation2 = "D:\2\test.xls" strNetworkLocation3 = "D:\3\test.xls" 'Create new workbook and copy sheets Set wkbNew = Workbooks.Add ThisWorkbook.Sheets("Find").Copy Befo=wkbNew.Sheets(1) ThisWorkbook.Sheets("REQ").Copy Befo=wkbNew.Sheets(1) 'Delete unwanted sheets On Error Resume Next Application.DisplayAlerts = False Sheets("Sheet1").Delete Sheets("Sheet2").Delete Sheets("Sheet3").Delete Application.DisplayAlerts = True On Error GoTo 0 'Save in location 1 wkbNew.SaveAs Filename:=strNetworkLocation1 wkbNew.Close Set wkbNew = Nothing 'Copy file to other locations FileCopy strNetworkLocation1, strNetworkLocation2 FileCopy strNetworkLocation1, strNetworkLocation3 End Sub Please rate this post if it ansers your question. Thanks, Chris www.ProfessionalExcel.com "XP" wrote: Using Excel 2007 and Win XP; I run a VBA program that sets up several sheets. Now I want to code a distribution program that copies two of the sheets, one called "Find" and another called "REQ" from the "program file" into a new file, then copy that file out to three different network locations for users to view/use. Any assistance/shortcuts you could offer in the code to do this would be most appreciated. Thanks in advance. |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I'll tweak and give it a go; thanks! "ProfessionalExcel.com" wrote: Something like the following should help (you will need to set the network locations): Sub DistributeSheets() Dim wkbNew As Workbook Dim strNetworkLocation1 As String Dim strNetworkLocation2 As String Dim strNetworkLocation3 As String 'Set location strNetworkLocation1 = "D:\1\test.xls" strNetworkLocation2 = "D:\2\test.xls" strNetworkLocation3 = "D:\3\test.xls" 'Create new workbook and copy sheets Set wkbNew = Workbooks.Add ThisWorkbook.Sheets("Find").Copy Befo=wkbNew.Sheets(1) ThisWorkbook.Sheets("REQ").Copy Befo=wkbNew.Sheets(1) 'Delete unwanted sheets On Error Resume Next Application.DisplayAlerts = False Sheets("Sheet1").Delete Sheets("Sheet2").Delete Sheets("Sheet3").Delete Application.DisplayAlerts = True On Error GoTo 0 'Save in location 1 wkbNew.SaveAs Filename:=strNetworkLocation1 wkbNew.Close Set wkbNew = Nothing 'Copy file to other locations FileCopy strNetworkLocation1, strNetworkLocation2 FileCopy strNetworkLocation1, strNetworkLocation3 End Sub Please rate this post if it ansers your question. Thanks, Chris www.ProfessionalExcel.com "XP" wrote: Using Excel 2007 and Win XP; I run a VBA program that sets up several sheets. Now I want to code a distribution program that copies two of the sheets, one called "Find" and another called "REQ" from the "program file" into a new file, then copy that file out to three different network locations for users to view/use. Any assistance/shortcuts you could offer in the code to do this would be most appreciated. Thanks in advance. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Save document to multiple locations | New Users to Excel | |||
save to multiple locations simultaneously | Excel Discussion (Misc queries) | |||
using macros to save files in different locations | Excel Programming | |||
can you automatically save files to two different locations? | Excel Discussion (Misc queries) | |||
Copy text files into multiple sheets of 1 workbook | Excel Programming |