Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default macro dont continue after save as

the macro i am trying need to save as the file with name
"prevdayinventry.xls" and then need to clear the original workbook called
"inventry.xls".

macro called "newday" used to work to clear the page after promting the user
if they are sure they need to clear. now it stops runing after it
create/update "prevdayinventry.xls"

here is a extract from my macro:


Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "'ok' to clear page ... 'cancel' to go back" ' Define message.
Style = vbOKCancel ' Define buttons.
Title = "Maykent t/a KFC" ' Define title.
Help = "DEMO.HLP" ' Define Help file.
Ctxt = 1000 ' Define topic
' context.
' Display message.
Response = MsgBox(Msg, Style, Title)
If Response = vbOKCancel Then ' User chose Yes.


Sheets("DATA").Select

ChDir "C:\maykent\inventry"

Application.DisplayAlerts = False

ActiveWorkbook.SaveAs
Filename:="C:\maykent\inventry\prevdayINVENTRY.xls ", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False


Application.DisplayAlerts = True


Workbooks.Open Filename:= _
"C:\maykent\inventry\inventry.xls"

Windows("prevdayINVENTRY.xls").Activate
ActiveWindow.Close savechanges:=True



Windows("INVENTRY.xls").Activate

Sheets("data").Select

Range("b93").Select
Selection.ClearContents


Sheets("data capture").Select
Range("C1:C48").Select
Selection.ClearContents

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default macro dont continue after save as

You are closing the workbook that contains the macro. Of course it is going
to stop. You need to have a master workbook that opens and closes files or
don't close the workbook just save the data.

"pswanie" wrote:

the macro i am trying need to save as the file with name
"prevdayinventry.xls" and then need to clear the original workbook called
"inventry.xls".

macro called "newday" used to work to clear the page after promting the user
if they are sure they need to clear. now it stops runing after it
create/update "prevdayinventry.xls"

here is a extract from my macro:


Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "'ok' to clear page ... 'cancel' to go back" ' Define message.
Style = vbOKCancel ' Define buttons.
Title = "Maykent t/a KFC" ' Define title.
Help = "DEMO.HLP" ' Define Help file.
Ctxt = 1000 ' Define topic
' context.
' Display message.
Response = MsgBox(Msg, Style, Title)
If Response = vbOKCancel Then ' User chose Yes.


Sheets("DATA").Select

ChDir "C:\maykent\inventry"

Application.DisplayAlerts = False

ActiveWorkbook.SaveAs
Filename:="C:\maykent\inventry\prevdayINVENTRY.xls ", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False


Application.DisplayAlerts = True


Workbooks.Open Filename:= _
"C:\maykent\inventry\inventry.xls"

Windows("prevdayINVENTRY.xls").Activate
ActiveWindow.Close savechanges:=True



Windows("INVENTRY.xls").Activate

Sheets("data").Select

Range("b93").Select
Selection.ClearContents


Sheets("data capture").Select
Range("C1:C48").Select
Selection.ClearContents

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default macro dont continue after save as

any sugestions on how to edit the code to get a "backup" of the workbook
writen in to the code just after the user choose yes to clear the workbook
but before clearing.

my gues would be that by save as i interupt the code. but whats my
alternatives?


"Joel" wrote:

You are closing the workbook that contains the macro. Of course it is going
to stop. You need to have a master workbook that opens and closes files or
don't close the workbook just save the data.

"pswanie" wrote:

the macro i am trying need to save as the file with name
"prevdayinventry.xls" and then need to clear the original workbook called
"inventry.xls".

macro called "newday" used to work to clear the page after promting the user
if they are sure they need to clear. now it stops runing after it
create/update "prevdayinventry.xls"

here is a extract from my macro:


Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "'ok' to clear page ... 'cancel' to go back" ' Define message.
Style = vbOKCancel ' Define buttons.
Title = "Maykent t/a KFC" ' Define title.
Help = "DEMO.HLP" ' Define Help file.
Ctxt = 1000 ' Define topic
' context.
' Display message.
Response = MsgBox(Msg, Style, Title)
If Response = vbOKCancel Then ' User chose Yes.


Sheets("DATA").Select

ChDir "C:\maykent\inventry"

Application.DisplayAlerts = False

ActiveWorkbook.SaveAs
Filename:="C:\maykent\inventry\prevdayINVENTRY.xls ", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False


Application.DisplayAlerts = True


Workbooks.Open Filename:= _
"C:\maykent\inventry\inventry.xls"

Windows("prevdayINVENTRY.xls").Activate
ActiveWindow.Close savechanges:=True



Windows("INVENTRY.xls").Activate

Sheets("data").Select

Range("b93").Select
Selection.ClearContents


Sheets("data capture").Select
Range("C1:C48").Select
Selection.ClearContents

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9,101
Default macro dont continue after save as

SAve AS a different filename which you are doing. Just don't close the
workbook before processing the Inventry.xls workbook.

"pswanie" wrote:

any sugestions on how to edit the code to get a "backup" of the workbook
writen in to the code just after the user choose yes to clear the workbook
but before clearing.

my gues would be that by save as i interupt the code. but whats my
alternatives?


"Joel" wrote:

You are closing the workbook that contains the macro. Of course it is going
to stop. You need to have a master workbook that opens and closes files or
don't close the workbook just save the data.

"pswanie" wrote:

the macro i am trying need to save as the file with name
"prevdayinventry.xls" and then need to clear the original workbook called
"inventry.xls".

macro called "newday" used to work to clear the page after promting the user
if they are sure they need to clear. now it stops runing after it
create/update "prevdayinventry.xls"

here is a extract from my macro:


Dim Msg, Style, Title, Help, Ctxt, Response, MyString
Msg = "'ok' to clear page ... 'cancel' to go back" ' Define message.
Style = vbOKCancel ' Define buttons.
Title = "Maykent t/a KFC" ' Define title.
Help = "DEMO.HLP" ' Define Help file.
Ctxt = 1000 ' Define topic
' context.
' Display message.
Response = MsgBox(Msg, Style, Title)
If Response = vbOKCancel Then ' User chose Yes.


Sheets("DATA").Select

ChDir "C:\maykent\inventry"

Application.DisplayAlerts = False

ActiveWorkbook.SaveAs
Filename:="C:\maykent\inventry\prevdayINVENTRY.xls ", _
FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
ReadOnlyRecommended:=False, CreateBackup:=False


Application.DisplayAlerts = True


Workbooks.Open Filename:= _
"C:\maykent\inventry\inventry.xls"

Windows("prevdayINVENTRY.xls").Activate
ActiveWindow.Close savechanges:=True



Windows("INVENTRY.xls").Activate

Sheets("data").Select

Range("b93").Select
Selection.ClearContents


Sheets("data capture").Select
Range("C1:C48").Select
Selection.ClearContents

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
dont confirm save with yes/no/cancell pswanie Excel Programming 2 June 18th 07 05:56 PM
Save file with different name and dont update the links when opened again [email protected] Excel Discussion (Misc queries) 0 January 25th 07 09:09 PM
Save file with different name and dont update the links when opened again [email protected] Excel Discussion (Misc queries) 0 January 25th 07 09:09 PM
Save file with different name and dont update the links when opened again [email protected] Excel Discussion (Misc queries) 0 January 25th 07 09:09 PM
'SAVE AS' WINDOW ICONS DONT WORK Excel 2000 SP3 Crustysquirrel Excel Discussion (Misc queries) 1 December 10th 04 10:30 PM


All times are GMT +1. The time now is 03:32 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"