[请问] excel的宏

楼主: meowde (甜水胡同)   2018-07-31 12:07:39
想请问擅长excel的大大们
如果要开启多个档案,每次开启都套用某模式开启
宏开启档案那部分要怎么改会比较好呢@@?
目前录制仅能开启相同的档案,
如果开启其他旧档案变成还要手动再去全部重案
跪求高手大大解答TT
只能手动一个一个把档名复制贴上吗?
还是可以用什么方法去套用在每个档案上呢?
谢谢..
以下是宏内容
Sub TEST3()
'
' TEST3 宏
'
'
Workbooks.OpenText Filename:="W:\●个人工作区\XXXXXXXXXXXXXXXXXXXXXXX.TXT", _
Origin:=950, StartRow:=1, DataType:=xlDelimited, TextQualifier:= _
xlDoubleQuote, ConsecutiveDelimiter:=False, Tab:=True, Semicolon:=False, _
Comma:=True, Space:=False, Other:=False, 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), Array(11, 1), Array(12, 1), Array(13, 1), Array(14, 1), Array(15 _
, 1), Array(16, 1), Array(17, 1), Array(18, 1), Array(19, 1), Array(20, 1), Array(21, 1), _
Array(22, 1), Array(23, 1), Array(24, 1), Array(25, 1)), TrailingMinusNumbers:=True
Range("H4:I9").Select
With Selection.Font
.Name = "Arial Unicode MS"
.Size = 12
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
With Selection.Font
.Name = "Arial Unicode MS"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ThemeColor = xlThemeColorLight1
.TintAndShade = 0
.ThemeFont = xlThemeFontNone
End With
With Selection.Interior
.Pattern = xlSolid
.PatternColorIndex = xlAutomatic
.ThemeColor = xlThemeColorDark1
.TintAndShade = 0
.PatternTintAndShade = 0
End With
With Selection
.HorizontalAlignment = xlCenter
.VerticalAlignment = xlCenter
.WrapText = False
.Orientation = 0
.AddIndent = False
.IndentLevel = 0
.ShrinkToFit = False
.ReadingOrder = xlContext
.MergeCells = False
End With
End Sub
作者: amethystboy (紫晶男)   2018-07-31 12:49:00
Application.GetOpenFilenameWorkbooks.Open
楼主: meowde (甜水胡同)   2018-07-31 13:44:00
a大谢谢您>< 请问是加在最一刚开始的地方吗?是不固定档名,但是固定的路径...
作者: xcoldx (反复默念的情话)   2018-07-31 20:46:00
写个循环资料夹逐个档案开启
作者: darkMood (瞬间投射)   2018-07-31 21:11:00
需求不清不楚啊
作者: yzfr6 (扮关二哥!)   2018-08-01 18:46:00
自己先厘清一下开档、档名的规则,再来谈怎么写

Links booklink

Contact Us: admin [ a t ] ucptt.com