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: 19
Default Inability to Copy Sheet to Other Workbooks

Hi,

I need to copy an instruction sheet from one workbook into a series of
workbooks. When I run the following procedure, I either get a
'Subscript out of Range' , or the procedure runs, but does not copy
the sheet. Any help you can lend with this would be most helpful.

--------------------------------------------

Sub Insert_Instructions()

Dim wbSource As Workbook
Dim wsInstructions As Worksheet

Dim vPath ' Unsure - string or variant?
Dim vName ' Unsure - string or variant?

Set wbSource = Workbooks.Open("c:\Instructions.xls")
Set wsInstructions = wbSource.Worksheets("Instructions")

vPath = "c:\ChangeRequests\"
vName = Dir(vPath, vbNormal)
Do While Not vName < ""
If (GetAttr(vPath & vName) And vbNormal) = vbNormal Then
Workbooks.Open vPath & vName
wsInstructions.Copy Befo=Workbooks(vPath &
vName).Sheets(1)
Workbooks(vPath & vName).Save
Workbooks(vPath & vName).Close
End If

vName = Dir
Loop

wbSource.Close SaveChanges:=False

Set wsInstructions = Nothing
Set wbSource = Nothing

End Sub

--------------------------------------------

Henry

 
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
Inability to open and run office apps. JHB Excel Discussion (Misc queries) 1 May 23rd 09 09:15 PM
Inability to alpha sort in any order Arkansas Sherri M Setting up and Configuration of Excel 2 June 12th 08 12:19 AM
Copy/ move selected data from workbooks to seperate worksheets or workbooks Positive Excel Worksheet Functions 1 August 30th 07 04:54 PM
Inability to create remote reference Edward Excel Discussion (Misc queries) 1 September 4th 06 03:36 PM
Inability to Capture Username Henry Stockbridge Excel Programming 3 February 20th 06 09:30 PM


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

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"