LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 102
Default Copying Worksheet to Another Open Workbook

Hi my post must not have gone through last night....

I finally go things to work...
Here is a simplified version:

Sub MyRoutine()
Dim wsh As Object
Dim fs As Object
Dim DesktopPath As String
Dim fname As String
Dim fStr As String
Dim arr As Variant
Dim wb As Workbook
Redim arr(1)
'arr represents my array of file names
arr(1) = "mynewfile.xls"
Set wsh = CreateObject("WScript.Shell")
Set fs = CreateObject("Scripting.FileSystemObject")
DesktopPath = wsh.SpecialFolders.Item("Desktop")
DirString = DesktopPath & "\MyNewFolder"
fstr = arr(1)
fname = DirString & "\" & fstr
Workbooks.add
Set wb = ActiveWorkbook
wb.SaveAs(fstr)
Workbooks("Myfirstworkbook.xls").Worksheets("mycop ysheet").Copy _
After:=Workbooks(fstr).Sheets(1)
..
..
..
..
End Sub

Thanks for your help. It might have been the .Close False although I
thought that meant that it shouldn't close it, maybe it means don't ask
something? or it could have been the xlWBATWorksheet that someone else
gave me. Doesn't seem needed anyway.

 
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
Copying Worksheet to Another Open Workbook [email protected] Excel Programming 2 September 15th 04 02:07 AM
Copying Worksheet to Another Open Workbook [email protected] Excel Programming 1 September 15th 04 01:59 AM
Copying Worksheet to Another Open Workbook [email protected] Excel Programming 1 September 15th 04 01:48 AM
Copying Worksheet to Another Open Workbook [email protected] Excel Programming 2 September 15th 04 01:32 AM
Copying Worksheet to Another Open Workbook [email protected] Excel Programming 2 September 15th 04 01:30 AM


All times are GMT +1. The time now is 05:14 PM.

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

About Us

"It's about Microsoft Excel"