ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel macros (https://www.excelbanter.com/excel-programming/283537-excel-macros.html)

SteveMcD

Excel macros
 

Q1. How do I disable the screen display when running a macro so that th
screen doesn't flash and jump about? I am using Excel 97 in Window
98.

Q2. The last thing the macro does is prompt for a filename and save th
workbook as that name. Is there any way of saving the workbook withou
saving the macro with it

-----------------------------------------------
~~ Message posted from http://www.ExcelTip.com
~~View and post usenet messages directly from http://www.ExcelForum.com


Jan Karel Pieterse

Excel macros
 
Hi SteveMcD,

Q1. How do I disable the screen display when running a macro so that the
screen doesn't flash and jump about? I am using Excel 97 in Windows
98.



Application.Screenupdating=False

And at the end

Application.Screenupdating=True

Q2. The last thing the macro does is prompt for a filename and save the
workbook as that name. Is there any way of saving the workbook without
saving the macro with it?


You could copy the worksheets to a new workbook (which does copy code
behind the sheets though):

Sub test()
Dim oNewbook As Workbook
ActiveWorkbook.Sheets.Copy
Set oNewbook = ActiveWorkbook
oNewbook.SaveAs "c:\data\test.xls"
oNewbook.Close False
Set oNewbook = Nothing
End Sub


Regards,

Jan Karel Pieterse
Excel MVP
www.jkp-ads.com


SteveMcD[_3_]

Excel macros
 

Many thanks Jan,

Both your solutions worked perfectly.

Steve


------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~View and post usenet messages directly from http://www.ExcelForum.com/



All times are GMT +1. The time now is 01:13 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com