- Search ExcelTip.com
directly from Excel
- Get immediate access to the
"Tip of the Hour"
- View hundreds of Microsoft
Excel tips with a click of a button
- Absolutely
Free - Click
here to download
Make your Amazon.com purchases by clicking the graphic below
|
Excel Tip .com - Mailing List Thread Index
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Code after Application.Run not working
See if this is better
Sub Macro4()
Workbooks.Open FileName:="C:\yourfolder\yourfile.xls"
With ActiveWorkbook
.Sheets("sheet2").Range("a1") = _
.Sheets("sheet1").Range("b2")
.Save
End With
ActiveWindow.Close
End Sub
Don Guillett
SalesAid Software
Granite Shoals, TX
donaldb@281.com
----- Original Message -----
From: "Jim ." <Escojpoer@AOL.COM>
To: <EXCEL-G@PEACH.EASE.LSOFT.COM>
Sent: Wednesday, July 30, 2003 10:33 AM
Subject: Code after Application.Run not working
> Hi-
> I have this piece of code below that runs, then opens another wb, runs
> the code in that wb(Transfer2), then closes and saves that wb, then(while
> stepping through), the cursor goes to the line
"Application.ScreenUpdating=True",
> but the line is not highlighted in yellow (as all steps are in stepping
> through). Then if I continue to hit F8, it goes back to the beginning of the
> Transfer mac and starts again. Why does it not continue through after it
closes the
> other wb?? It's like it steps out completely after closing the ITEHH.xls wb.
> Jim
>
> Sub Transfer()
> Application.EnableEvents = False
> Application.DisplayAlerts = False
> Workbooks.Open Filename:="C:\ftpfiles\ITE11.WK3"
> Range("V8:AG152").Select
> Selection.Copy
> Windows("ITECAT3D.xls").Activate
> Range("B8").Select
> ActiveSheet.Paste
> Windows("ITE11.WK3").Activate
> ActiveWindow.Close
> Application.DisplayAlerts = True
> ChDir "C:\Documents and Settings\ITEREBATES"
> Workbooks.Open Filename:= _
> "C:\Documents and Settings\ITEREBATES\ITEHH.xls"
> Application.Run ("ITEHH.XLS!Transfer2")' Stops here, but goes back to
> beginning of this macro and runs again
> Application.ScreenUpdating = True
> Application.EnableEvents = True
> ActiveWorkbook.Save
> Application.Quit
> End Sub
>
> ****Below is code in ITEHH.xls workbook***************
>
> Sub Transfer2()
> Application.DisplayAlerts = False
> Workbooks.Open Filename:="C:\ftpfiles\ITEHH1.WK3"
> Range("V8").Select
> Selection.Copy
> Windows("ITEHH.xls").Activate
> Range("A8").Select
> ActiveSheet.Paste
> Windows("ITEHH1.WK3").Activate
> ActiveWindow.Close
> Application.DisplayAlerts = True
> ActiveWorkbook.Close savechanges:=True
> End Sub
>
> --------------------------------------------------------------------------
> The EXCEL-G list is hosted on a Windows NT(TM) machine running L-Soft
> international's LISTSERV(R) software. For subscription/signoff info
> and archives, see http://peach.ease.lsoft.com/archives/excel-g.html .
> COPYRIGHT INFO:
> http://peach.ease.lsoft.com/scripts/wa.exe?SHOWTPL=COPYRIGHT&L=EXCEL-G
>
--------------------------------------------------------------------------
The EXCEL-G list is hosted on a Windows NT(TM) machine running L-Soft
international's LISTSERV(R) software. For subscription/signoff info
and archives, see http://peach.ease.lsoft.com/archives/excel-g.html .
COPYRIGHT INFO:
http://peach.ease.lsoft.com/scripts/wa.exe?SHOWTPL=COPYRIGHT&L=EXCEL-G
|
And at your local bookseller


Excel Training Level I
Excel
Training Level II
Excel
Training Level III
Excel
VBA Training Level I
Excel
VBA Training Level II
View All Excel Training Programs

Formula Manager
Duplication
Manager
Text
Manager
Number
Manager
Add-ins
Collection
Spreadsheet
Assistant
Number
Manager
Add-ins
Collection
Spreadsheet
Assistant
View All Excel Add-Ins
|