Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default New WorkBook Macro Looking to WRONG WorkBook

The macro i am using to create a Copy of the Active WorkBook is:

Sub Macro20()
' This macro prompts you that MAX sheets is reached and to Name the New Copy (sheet1,sheet2)
' Range("A4").Select
' Selection.ClearContents
res = InputBox("MAXIMUM File SIZE REACHED, Enter the NAME for the NEW file ? ", "Title here...")
If res = "" Then Exit Sub
With ActiveWorkbook
Worksheets(Array("Enter-Exit Page", "1")).Copy
ThisWorkbook.Save ' <================= Refers to Original WorkBook
ThisWorkbook.Close ' <================ Refers to Original WorkBook

' <==== res to be the NAME NEW WorkBook is SAVED AS HERE

End With
ActiveWindow.DisplayWorkbookTabs = True
With ActiveWindow
.DisplayHorizontalScrollBar = True
.DisplayVerticalScrollBar = False
End With
End Sub

But, When i run another macro in the New Copy, the ORIGINAL WorkBook Opens Back Up ???

Why is that ?

Code running when this happens is:

If .Worksheets.Count < 5 Then
End If
End With
With ActiveWorkbook
..Worksheets("1").Copy After:=.Worksheets(.Worksheets.Count)
ActiveSheet.Name = Worksheets.Count
UserForm1.Hide
Dim myFileName As Variant
Dim NewWksName As String
Dim NewWkbk As Workbook
Dim NewWks As Worksheet
NewWksName = Worksheets.Count
' Me.ComboBox1.Value
With NewWkbk
Set NewWks = Nothing
On Error Resume Next
Set NewWks = .Worksheets(NewWksName)
On Error GoTo 0
End With
If NewWks Is Nothing Then
End If
[B3].Select
ActiveCell = Me.ComboBox1.Value
' Set NewWks = ActiveSheet
' With NewWks
' .Name = Me.ComboBox1.Value
' .Range("B3").Value = NewWksName
End With
End Sub


Can anyone point me in teh right direction of where to look for a solution to this, please.
regards

Corey....
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
Combine worksheets in multiple workbook in one workbook with a macro Sam Commar Excel Discussion (Misc queries) 2 April 2nd 09 01:09 PM
Macro to copy an image (or picture) from one workbook to a new sheetin another workbook Ruchir Excel Worksheet Functions 1 July 25th 08 07:29 AM
Macro linking to wrong workbook Tim879 Excel Discussion (Misc queries) 2 August 31st 07 03:36 PM
Running a macro to protect a workbook on a already protected workbook UNprotects the workbook ?? WimR Excel Programming 9 July 25th 05 12:44 PM
Excel Gurus = want a macro in 1 workbook to get info from another workbook = Read please harry Excel Programming 5 December 20th 03 03:26 AM


All times are GMT +1. The time now is 07:55 PM.

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"