santeria
Well-known Member
- Joined
- Oct 7, 2003
- Messages
- 1,844
This worked great once, except for a sort of "Flashy Screen" type thing.
And it queried on Something about There are large amounts of Data on the Clipboard, do you want to save them for later use YES or NO. Well, I want to get that gone, but I don't know how.
And Whilst I realise this Macro is a fair bit of a pigs breakfast, I am trying to get the Page Definition somehow standard. On line 246, the thing errors at " .Print Quality = .3 " and I don't know why, and all page formatting stops.
Also, can I get the File name to print in the header in this macro, or is it best to do that in the template?
Help Much appreciated.
Ta
And it queried on Something about There are large amounts of Data on the Clipboard, do you want to save them for later use YES or NO. Well, I want to get that gone, but I don't know how.
And Whilst I realise this Macro is a fair bit of a pigs breakfast, I am trying to get the Page Definition somehow standard. On line 246, the thing errors at " .Print Quality = .3 " and I don't know why, and all page formatting stops.
Also, can I get the File name to print in the header in this macro, or is it best to do that in the template?
Code:
Sub DSGIUPDATES()
'
' DSGIUPDATES Macro
'
'
Workbooks.OpenText Filename:="F:\Reports\DSGI UPDATES\DATA\DAILY\1.dat", _
Origin:=xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, _
Comma:=True, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 2), _
Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 2), Array(6, 2), Array(7, 2), Array(8, 2), _
Array(9, 2), Array(10, 2), Array(11, 2), Array(12, 2), Array(13, 2), Array(14, 2), Array(15 _
, 2), Array(16, 2), Array(17, 2), Array(18, 2))
Range("A1:Z2000").Select
ActiveWindow.ScrollColumn = 1
ActiveWindow.ScrollRow = 1
Selection.Copy
Windows("DSGI DAILY UPDATES1").Activate
Sheets("FLEX ").Select
Range("A2").Select
ActiveSheet.Paste
Windows("1.dat").Activate
ActiveWorkbook.Close
Range("G11").Select
Workbooks.OpenText Filename:="F:\Reports\DSGI UPDATES\DATA\DAILY\2.dat", _
Origin:=xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, _
Comma:=True, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 2), _
Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 2), Array(6, 2), Array(7, 2), Array(8, 2), _
Array(9, 2), Array(10, 2), Array(11, 2), Array(12, 2), Array(13, 2), Array(14, 2), Array(15 _
, 2), Array(16, 2), Array(17, 2), Array(18, 2), Array(19, 2), Array(20, 2), Array(21, 2), _
Array(22, 2), Array(23, 2), Array(24, 2), Array(25, 2), Array(26, 2), Array(27, 2), Array( _
28, 2), Array(29, 2), Array(30, 2), Array(31, 2), Array(32, 2), Array(33, 2), Array(34, 2), _
Array(35, 2), Array(36, 2), Array(37, 2), Array(38, 2), Array(39, 2), Array(40, 2), Array( _
41, 2), Array(42, 2), Array(43, 2), Array(44, 2), Array(45, 2), Array(46, 2), Array(47, 2), _
Array(48, 2), Array(49, 2), Array(50, 2), Array(51, 2))
Range("A1:BI2000").Select
ActiveWindow.ScrollColumn = 1
ActiveWindow.ScrollRow = 1
Selection.Copy
Windows("DSGI DAILY UPDATES1").Activate
Sheets("Medical").Select
Range("A2").Select
ActiveSheet.Paste
Windows("2.dat").Activate
ActiveWorkbook.Close
Range("E15").Select
Workbooks.OpenText Filename:="F:\Reports\DSGI UPDATES\DATA\DAILY\3.dat", _
Origin:=xlWindows, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, _
Comma:=True, Space:=False, Other:=False, FieldInfo:=Array(Array(1, 2), _
Array(2, 2), Array(3, 2), Array(4, 2), Array(5, 2), Array(6, 2), Array(7, 2), Array(8, 2), _
Array(9, 2), Array(10, 2), Array(11, 2), Array(12, 2), Array(13, 2), Array(14, 2), Array(15 _
, 2), Array(16, 2), Array(17, 2))
Range("A1:V2000").Select
ActiveWindow.ScrollColumn = 1
ActiveWindow.ScrollRow = 1
Selection.Copy
Windows("DSGI DAILY UPDATES1").Activate
Sheets("SUPP").Select
Range("A2").Select
ActiveSheet.Paste
Windows("3.dat").Activate
ActiveWorkbook.Close
Range("K15").Select
Sheets("Medical").Select
Range("B:B,C:C,D:D,J:J,K:K").Select
Range("K1").Activate
Selection.Copy
Sheets("COUNTY CODES").Select
Range("A1").Select
ActiveSheet.Paste
Columns("A:E").EntireColumn.AutoFit
Range("F:F,G:G,H:H,I:I,J:J,K:K").Select
Range("K1").Activate
ActiveWindow.SmallScroll ToRight:=6
Range("F:F,G:G,H:H,I:I,J:J,K:K,L:L,M:M,N:N,O:O,P:P,Q:Q,R:R,S:S,T:T,U:U").Select
Range("U1").Activate
ActiveWindow.SmallScroll ToRight:=9
Range( _
"F:F,G:G,H:H,I:I,J:J,K:K,L:L,M:M,N:N,O:O,P:P,Q:Q,R:R,S:S,T:T,U:U,V:V,W:W,X:X,Y:Y,Z:Z,AA:AA,AB:AB,AC:AC,AD:AD" _
).Select
Range("AD1").Activate
ActiveWindow.SmallScroll ToRight:=13
Union(Range( _
"AL:AL,AM:AM,AN:AN,AO:AO,AP:AP,AQ:AQ,F:F,G:G,H:H,I:I,J:J,K:K,L:L,M:M,N:N,O:O,P:P,Q:Q,R:R,S:S,T:T,U:U,V:V,W:W,X:X,Y:Y,Z:Z,AA:AA,AB:AB,AC:AC,AD:AD,AE:AE" _
), Range("AF:AF,AG:AG,AH:AH,AI:AI,AJ:AJ,AK:AK")).Select
Range("AQ1").Activate
ActiveWindow.SmallScroll ToRight:=9
Union(Range( _
"AL:AL,AM:AM,AN:AN,AO:AO,AP:AP,AQ:AQ,AR:AR,AS:AS,AT:AT,AU:AU,AV:AV,AW:AW,AX:AX,AY:AY,F:F,G:G,H:H,I:I,J:J,K:K,L:L,M:M,N:N,O:O,P:P,Q:Q,R:R,S:S,T:T,U:U,V:V,W:W" _
), Range( _
"X:X,Y:Y,Z:Z,AA:AA,AB:AB,AC:AC,AD:AD,AE:AE,AF:AF,AG:AG,AH:AH,AI:AI,AJ:AJ,AK:AK" _
)).Select
Range("AY1").Activate
Application.CutCopyMode = False
Selection.Delete Shift:=xlToLeft
Range("F7").Select
Sheets("FLEX ").Select
Columns("A:A").EntireColumn.AutoFit
Columns("H:H").Select
ActiveWindow.SmallScroll ToRight:=6
Range("K9").Select
ActiveWindow.LargeScroll ToRight:=-1
Range("H:H,M:M,N:N,O:O").Select
Range("O1").Activate
ActiveWindow.SmallScroll ToRight:=6
Range("H:H,M:M,N:N,O:O,P:P,Q:Q,R:R").Select
Range("R1").Activate
Selection.Delete Shift:=xlToLeft
Range("N8").Select
ActiveWindow.ScrollColumn = 1
Sheets("Medical").Select
Range("E6,B:B,C:C,D:D").Select
Range("D1").Activate
ActiveWindow.LargeScroll ToRight:=1
Range("E6,B:B,C:C,D:D,Y:Y,Z:Z,AA:AA").Select
Range("AA1").Activate
ActiveWindow.SmallScroll ToRight:=4
Range("E6,B:B,C:C,D:D,Y:Y,Z:Z,AA:AA,AB:AB,AC:AC,AD:AD").Select
Range("AD1").Activate
ActiveWindow.LargeScroll ToRight:=-1
Range("N23").Select
ActiveWindow.LargeScroll ToRight:=-1
Range("B:B,C:C").Select
Range("C1").Activate
ActiveWindow.LargeScroll ToRight:=1
Range("B:B,C:C,Y:Y,Z:Z,AB:AB,AC:AC,AD:AD").Select
Range("AD1").Activate
Selection.Copy
Sheets("LIFE").Select
Range("A1").Select
ActiveSheet.Paste
Columns("A:G").EntireColumn.AutoFit
Range("H8,H:H,I:I").Select
Range("I1").Activate
ActiveWindow.SmallScroll ToRight:=5
Range("H8,H:H,I:I,J:J,K:K,L:L,M:M,N:N,O:O,P:P,Q:Q,R:R").Select
Range("R1").Activate
ActiveWindow.SmallScroll ToRight:=7
Range( _
"H8,H:H,I:I,J:J,K:K,L:L,M:M,N:N,O:O,P:P,Q:Q,R:R,S:S,T:T,U:U,V:V,W:W,X:X,Y:Y,Z:Z,AA:AA" _
).Select
Range("AA1").Activate
ActiveWindow.SmallScroll ToRight:=9
Range( _
"H8,H:H,I:I,J:J,K:K,L:L,M:M,N:N,O:O,P:P,Q:Q,R:R,S:S,T:T,U:U,V:V,W:W,X:X,Y:Y,Z:Z,AA:AA,AB:AB,AC:AC,AD:AD" _
).Select
Range("AD1").Activate
ActiveWindow.SmallScroll ToRight:=5
Range( _
"H8,H:H,I:I,J:J,K:K,L:L,M:M,N:N,O:O,P:P,Q:Q,R:R,S:S,T:T,U:U,V:V,W:W,X:X,Y:Y,Z:Z,AA:AA,AB:AB,AC:AC,AD:AD,AE:AE,AF:AF,AG:AG,AH:AH,AI:AI,AJ:AJ" _
).Select
Range("AJ1").Activate
ActiveWindow.SmallScroll ToRight:=6
Union(Range( _
"AM:AM,AN:AN,AO:AO,AP:AP,AQ:AQ,AR:AR,AS:AS,H8,H:H,I:I,J:J,K:K,L:L,M:M,N:N,O:O,P:P,Q:Q,R:R,S:S,T:T,U:U,V:V,W:W,X:X,Y:Y,Z:Z,AA:AA,AB:AB,AC:AC,AD:AD,AE:AE" _
), Range("AF:AF,AG:AG,AH:AH,AI:AI,AJ:AJ,AK:AK,AL:AL")).Select
Range("AS1").Activate
ActiveWindow.SmallScroll ToRight:=6
Union(Range( _
"AM:AM,AN:AN,AO:AO,AP:AP,AQ:AQ,AR:AR,AS:AS,AT:AT,AU:AU,AV:AV,AW:AW,AX:AX,AY:AY,H8,H:H,I:I,J:J,K:K,L:L,M:M,N:N,O:O,P:P,Q:Q,R:R,S:S,T:T,U:U,V:V,W:W,X:X,Y:Y" _
), Range( _
"Z:Z,AA:AA,AB:AB,AC:AC,AD:AD,AE:AE,AF:AF,AG:AG,AH:AH,AI:AI,AJ:AJ,AK:AK,AL:AL")) _
.Select
Range("AY1").Activate
Application.CutCopyMode = False
ActiveWindow.LargeScroll ToRight:=-3
ActiveWindow.SmallScroll ToRight:=-5
ActiveWindow.ScrollColumn = 27
ActiveWindow.ScrollColumn = 1
Columns("H:AY").Select
Selection.Delete Shift:=xlToLeft
Range("H1").Select
Sheets("Medical").Select
Range("R8").Select
ActiveWindow.SmallScroll ToRight:=24
ActiveWindow.ScrollColumn = 1
Range("A:A,E:E,F:F,H:H,I:I,J:J,K:K,N:N").Select
Range("N1").Activate
ActiveWindow.SmallScroll ToRight:=5
Range("A:A,E:E,F:F,H:H,I:I,J:J,K:K,N:N,O:O,P:P,Q:Q,R:R").Select
Range("R1").Activate
Selection.Delete Shift:=xlToLeft
ActiveWindow.ScrollColumn = 1
Range("G:G,H:H,I:I,J:J,K:K,M:M,N:N,O:O").Select
Range("O1").Activate
Selection.Delete Shift:=xlToLeft
Range("H1").Select
ActiveWindow.SmallScroll ToRight:=4
Range("H:H,I:I,J:J,K:K,L:L,M:M,N:N,O:O,P:P").Select
Range("P1").Activate
Selection.Delete Shift:=xlToLeft
Range("H:H,I:I,J:J,K:K,L:L,M:M,P:P").Select
Range("P1").Activate
Selection.Delete Shift:=xlToLeft
Range("J:J,K:K,L:L,M:M,N:N,O:O").Select
Range("O1").Activate
Selection.Delete Shift:=xlToLeft
Range("J5").Select
ActiveWindow.ScrollColumn = 1
Columns("A:A").EntireColumn.AutoFit
Columns("I:I").EntireColumn.AutoFit
Columns("C:C").EntireColumn.AutoFit
Columns("B:B").EntireColumn.AutoFit
Sheets("SUPP").Select
Columns("J:Q").Select
Selection.Delete Shift:=xlToLeft
Range("J5").Select
ActiveWindow.LargeScroll ToRight:=-1
Columns("A:A").EntireColumn.AutoFit
Sheets("COUNTY CODES").Select
Columns("A:A").EntireColumn.AutoFit
Columns("B:B").EntireColumn.AutoFit
Columns("C:C").EntireColumn.AutoFit
Sheets("FLEX ").Select
Columns("A:A").ColumnWidth = 9.14
Columns("A:A").EntireColumn.AutoFit
Sheets("LIFE").Select
Columns("B:B").ColumnWidth = 16
Columns("B:B").EntireColumn.AutoFit
Columns("F:F").EntireColumn.AutoFit
Sheets("COUNTY CODES").Select
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = -3
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
End With
Sheets("FLEX ").Select
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = -3
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
End With
Sheets("LIFE").Select
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = -3
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
End With
Sheets("Medical").Select
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = -3
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
End With
Sheets("SUPP").Select
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = -3
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlLandscape
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
End With
End Sub
Help Much appreciated.
Ta