BakersDozen
06-25-2005, 02:06 AM
Hi all. I am new here
I am hoping to have a piece of Excel Macro Code solved here please.
The current Code is:
The Cut Action changes the log file opened by Excel.
I need to Change the altered Log File when Save and these Dialog Boxes keep apprearing.
The Problem is here:
Windows("Test_script.log").Activate
Range("A1").Select
Application.CutCopyMode = False
ActiveWorkbook.Close SaveChanges:=False
'CLOSES TXT FILE ***_WHITHOUT SAVING_***
' and NO DIALOG BOXES.
'The Problem Ends here.
I need to change:
ActiveWorkbook.Close SaveChanges:=False
to :
ActiveWorkbook.Close SaveChanges:=True
' but the dialog boxes show.
Complete Recorded Macro Sequence for a "bigger picture" is here:
Sub MainTest1()
'opening Log FILE
ChDir "C:\Program Files\Program\Logs"
Workbooks.OpenText Filename:= _
"C:\Program Files\Program\Logs\Test.log", Origin:= _
xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True, Semicolon:=True, _
Comma:=True, Space:=True, Other:=True, OtherChar:="-", FieldInfo:= _
Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7 _
, 1), Array(8, 1), Array(9, 1), Array(10, 1))
Cells.Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
Selection.Columns.AutoFit
Range("A1").Select
Cells.Select
Selection.Copy
'transfering at this point-
Windows("TestWorkBook1").Activate
Sheets("Sheet3").Select
Range("A1").Select
ActiveSheet.Paste
Range("A1").Select
'transfer done.
Windows("Test.log").Activate
'Changes to code need to be done here.
'old
Range("A1").Select
Application.CutCopyMode = False
ActiveWorkbook.Close SaveChanges:=False
'closes file but not to Save. Ok for testing.
'new,
'Need to Save/ Close file and NO dialog boxes
End Sub
There is a new log file being updated from every 30 second at times to every 1 minute and at random intervals to.
This makes it very difficult to have a normal life when logging goes on for about 10 hours per day,7 Days per week and these dialog boxes keep appearing.
I am hoping to have a piece of Excel Macro Code solved here please.
The current Code is:
The Cut Action changes the log file opened by Excel.
I need to Change the altered Log File when Save and these Dialog Boxes keep apprearing.
The Problem is here:
Windows("Test_script.log").Activate
Range("A1").Select
Application.CutCopyMode = False
ActiveWorkbook.Close SaveChanges:=False
'CLOSES TXT FILE ***_WHITHOUT SAVING_***
' and NO DIALOG BOXES.
'The Problem Ends here.
I need to change:
ActiveWorkbook.Close SaveChanges:=False
to :
ActiveWorkbook.Close SaveChanges:=True
' but the dialog boxes show.
Complete Recorded Macro Sequence for a "bigger picture" is here:
Sub MainTest1()
'opening Log FILE
ChDir "C:\Program Files\Program\Logs"
Workbooks.OpenText Filename:= _
"C:\Program Files\Program\Logs\Test.log", Origin:= _
xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=True, Tab:=True, Semicolon:=True, _
Comma:=True, Space:=True, Other:=True, OtherChar:="-", FieldInfo:= _
Array(Array(1, 1), Array(2, 1), Array(3, 1), Array(4, 1), Array(5, 1), Array(6, 1), Array(7 _
, 1), Array(8, 1), Array(9, 1), Array(10, 1))
Cells.Select
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = False
End With
Selection.Columns.AutoFit
Range("A1").Select
Cells.Select
Selection.Copy
'transfering at this point-
Windows("TestWorkBook1").Activate
Sheets("Sheet3").Select
Range("A1").Select
ActiveSheet.Paste
Range("A1").Select
'transfer done.
Windows("Test.log").Activate
'Changes to code need to be done here.
'old
Range("A1").Select
Application.CutCopyMode = False
ActiveWorkbook.Close SaveChanges:=False
'closes file but not to Save. Ok for testing.
'new,
'Need to Save/ Close file and NO dialog boxes
End Sub
There is a new log file being updated from every 30 second at times to every 1 minute and at random intervals to.
This makes it very difficult to have a normal life when logging goes on for about 10 hours per day,7 Days per week and these dialog boxes keep appearing.