ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Application (https://www.excelbanter.com/excel-programming/337895-application.html)

Michael

Application
 
Hi.

My excel application is in a network, its a program that help the user to
report different stuff. Because the report number increase automatically the
application is saved with the new report number right after its opened, then
its saved again to another location, but this location should be temporary.

Here is the code i have.

*** First the application is saved back to its original folder with the new
report number.

ReportNumber = ActiveSheet.Range("e5").Value
ReportNumber = ActiveSheet.Range("e5").Value + 1

ActiveSheet.Range("e5").Value = ReportNumber

If Me.Saved = False Then Me.Save

*** Then its saved to a new folder ( and this should be temporary).

FileSaveName = ActiveWorkbook.Path
FileSaveNameEnd = FileSaveName & "\Arkiv\"
varName = ActiveSheet.Name
varDir = FileSaveNameEnd
varYear = Format(Date, "yy")
varNr = ReportNumber

On Error GoTo ErrorHandler:

ActiveSheet.SaveAs Filename:=varDir & varName & varNr & varYear

My question is:

Is it possible to save just the sheet and not the whole application, i dont
want the report to include the macros after it is saved to its right location.

And is there a command to delete the application after the user is done,
-the application that is saved in the temporary folder.

Mike


Bob Phillips[_6_]

Application
 
If you want to copy the sheet you need to copy it to a new workbook first,
then save that new workbook. If you follow those steps in Excel with the
macro recorder on you should get the code that you need.

When you say delete the application, I presume that you mean the workbook.
Check out Kill in VBA help.
--

HTH

RP
(remove nothere from the email address if mailing direct)


"Michael" wrote in message
...
Hi.

My excel application is in a network, its a program that help the user to
report different stuff. Because the report number increase automatically

the
application is saved with the new report number right after its opened,

then
its saved again to another location, but this location should be

temporary.

Here is the code i have.

*** First the application is saved back to its original folder with the

new
report number.

ReportNumber = ActiveSheet.Range("e5").Value
ReportNumber = ActiveSheet.Range("e5").Value + 1

ActiveSheet.Range("e5").Value = ReportNumber

If Me.Saved = False Then Me.Save

*** Then its saved to a new folder ( and this should be temporary).

FileSaveName = ActiveWorkbook.Path
FileSaveNameEnd = FileSaveName & "\Arkiv\"
varName = ActiveSheet.Name
varDir = FileSaveNameEnd
varYear = Format(Date, "yy")
varNr = ReportNumber

On Error GoTo ErrorHandler:

ActiveSheet.SaveAs Filename:=varDir & varName & varNr & varYear

My question is:

Is it possible to save just the sheet and not the whole application, i

dont
want the report to include the macros after it is saved to its right

location.

And is there a command to delete the application after the user is done,
-the application that is saved in the temporary folder.

Mike





All times are GMT +1. The time now is 04:21 PM.

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