ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] VBA°O¿ý

[µo°Ý] VBA°O¿ý

¦U¦ì¤j¤j¦n,

§Ú¦b¤u§@¤¤¨Ï¥ÎªºVBA«D±`¦h,±`±`¦b°õ¦æ«áor§Ñ¤F¦³¨S¦³°õ¦æ,¥²¶·­n¶}±Ò³Q°õ¦æªºÀɮ׬d¬Ý,«D±`ªº¤£¤è«K,
µ{¦¡³£©T©w©ñ¦b¤@­Ó±Mªù¥Î¨Ó°õ¦æVBAªºMacro.xlsmÀɮפ¤,§Ú·Q°w¹ï10¦h­Óµ{¦¡,¦]¬°±K¶°¾Þ§@,¯S§O®e©ö²V²c...¨ì©³°õ¦æ¤F?§Ñ¤F°õ¦æ?
·Q½Ð°Ý¦³¨S¦³¤@ºØ¥i¥H°O¿ýVBAªº»yªk?¥i¥HÅý§Ú¦U¦Û¥[¦b¯S§O®e©ö²V²c¤£²MªºVBA«á­±,¨Ï¥¦¥i¥H©ß¥X¬°TXTÀÉ,§Ú§Æ±æ¥¦¥i¥H°O¿ý¥H¤U:
1. VBA¦WºÙ, ¨Ï¥Îor§¹¦¨®É¶¡ (¦]¬°µ{¦¡°õ¦æ³£«Ü§Ö³t,©Ò¥H¨ä¤¤¤@­Ó®É¶¡´N¥i¥H¤F),¦P¤@¦æ.¤¤¶¡¥[".........."¹j¶}
2. ÁöµMVBA¦U¦Û¿W¥ß,¦ý§Ú§Æ±æ抛¥XªºTXT³øªí,¥i¥H¨Ìµ{¦¡°õ¦æ¶¶§Ç¦Û°Ê±µÄò¼g¤U¥h,¦Ó¤£­n§â¼g¤JTXTªº¤º®e¤À¦¨«Ü¦hÀÉ®×.
3. TXT¦sÀɸô®|D:\0_¦Û­qªí³æ\VBA°O¿ý\ÀɦW:VBA_¦~¤ë¤é.TXT (¤@¤Ñ¤@­ÓÀɮקY¥i)
4. §Ú¦bMacro.xlsmÀɮפ¤¥[¤J¤@­ÓIJµo¶s,©¡®É¥i¥H³sµ²³o­Ó"VBA_¦~¤ë¤é.TXT"
5. ¼g¤JTXT¥u¦b¹õ«á°õ¦æ,¤£¥Î¶}±Ò,·í§Ú·Q¬d¬Ý®É¦A«öIJµo¶sÅý¥¦¦Û¦æ¥´¶}.
6.  ¨Ò¦p¡Gªþ¥ó¤¤ªºMacro.A.xlsm                                                                               Macro.A.rar (26.29 KB)
¸Ì­±©ñ¤F3­ÓVBA,§Æ±æTXT§e²{ªº¤º®e¬°¥H¤Uªº¨Ò¤l(¥u¬OÁ|¨Ò)

Sub backupfile()...........20190529 18:00:35
Sub ¿ï¨ú¤u§@ªíB2­È¤Æ()...........20190529 18:02:35
Sub ´ú¸Õ()...........20190529 18:10:35

¦^´_ 1# PJChen


   ³o¼Ë§A´N¦b³o­ÓÀɮפº¡A¥[¤@­¶LISTªº²M³æ¡A±N§A°õ¦æ¹LªºÀÉ®×°T®§¬ö¿ý¤U¨Ó´N¦n¤F¡C

TOP

¦^´_ 2# kim223824

½T¹ê¤â°Ê¤]¬O¤@­Ó¤èªk,¦ý§Ú·Q¾Çªº¬OVB°µªk,¤£¬O¥´¦r,§_«h¤]´N¤£¥Î°Ý¤H©Ô...

TOP

¥»©«³Ì«á¥Ñ n7822123 ©ó 2019-6-4 04:32 ½s¿è

¦^´_ 1# PJChen

§Aµ¹ªºÀɮקڥ´¤£¶}!

§Ú¦Û¤v°µ­Ó½d¨Ò
¦b§A¨C­Óµ{§Ç³Ì¤U­±©I¥s "°O¿ý"³o­Óµ{§Ç§Y¥i¡A­nµ¹¤©µ{§Ç¦WºÙ
¦p¤U¡A½Ð°Ñ¦Ò¬Ý¬Ý!
test-0604.rar (35.41 KB)

Sub backupfile()
'§Aªºµ{¦¡½X¶}©l
'........
'........
'........
'........
'§Aªºµ{¦¡½Xµ²§ô
°O¿ý "backupfile"
End Sub

Sub ¿ï¨ú¤u§@ªíB2­È¤Æ()
'§Aªºµ{¦¡½X¶}©l
'........
'........
'........
'........
'§Aªºµ{¦¡½Xµ²§ô
°O¿ý "¿ï¨ú¤u§@ªíB2­È¤Æ"
End Sub

Sub ´ú¸Õ()
'§Aªºµ{¦¡½X¶}©l
'........
'........
'........
'........
'§Aªºµ{¦¡½Xµ²§ô
°O¿ý "´ú¸Õ"
End Sub

Sub °O¿ý(ByVal subname As String)
'¸ô®|¡@D:\0_¦Û­qªí³æ\VBA°O¿ý\
'ÀɦW    VBA_¦~¤ë¤é.TXT
Dim ff$, txt As Object
Application.DisplayAlerts = False
Application.ScreenUpdating = False
fpath0 = "D:\0_¦Û­qªí³æ\VBA°O¿ý"    '¦Û¤v³]©w¸ô®|
If Dir(fpath0, 16) = "" Then MsgBox "§ä¤£¨ì¸ô®|¡A½Ð½T»{!": Exit Sub
fname = "VBA_" & Format(Now, "yyyymmdd") & ".txt"
fullnm = fpath0 & "\" & fname
ff = Dir(fullnm)
If ff = "" Then
  Set txt = Workbooks.Add
  txt.Sheets(2).Delete: txt.Sheets(2).Delete
  txt.Sheets(1).[A1] = "Sub " & subname & "..................." & Format(Now, "yyyymmddhhmmss")
  txt.SaveAs fullnm, xlTextPrinter
  txt.Close
End If
Set txt = Workbooks.Open(fullnm)
n& = txt.Sheets(1).Cells(Rows.Count, 1).End(3).Row
Cells(n + 1, 1) = "Sub " & subname & "..................." & Format(Now, "yyyymmddhhmmss")
txt.Close True
End Sub

Sub ¶}±Òtxt()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
fpath0 = "D:\0_¦Û­qªí³æ\VBA°O¿ý"    '¦Û¤v³]©w¸ô®|
If Dir(fpath0, 16) = "" Then MsgBox "§ä¤£¨ì¸ô®|¡A½Ð½T»{!": Exit Sub
fname = "VBA_" & Format(Now, "yyyymmdd") & ".txt"
fullnm = fpath0 & "\" & fname
ff = Dir(fullnm)
If ff = "" Then
  MsgBox "§ä¤£¨ì" & fullnm & "¡A½Ð½T»{!": Exit Sub
Else
  Shell "notepad " & fullnm
End If
End Sub
µ{¦¡¬O¨Ì»Ý¨D¼gªº¡A»Ý¨Dªí¹F¤£²M·¡
©ÎªÌ¨S¦³¤W¶Çªþ¥ó¡A·R²ö¯à§U

TOP

¥»©«³Ì«á¥Ñ n7822123 ©ó 2019-6-4 04:38 ½s¿è

¦^´_ 4# n7822123

txt.Sheets(1).[A1] = "Sub " & subname & "..................." & Format(Now, "yyyymmddhhmmss")
Cells(n + 1, 1) = "Sub " & subname & "..................." & Format(Now, "yyyymmddhhmmss")

³o¨â¦æ®æ¦¡¨S§ïªº¸ò§A¤@¼Ë
yyyymmddhhmmss ½Ð§ï yyyymmdd hh:mm:ss

test-0604.rar (36.17 KB)
µ{¦¡¬O¨Ì»Ý¨D¼gªº¡A»Ý¨Dªí¹F¤£²M·¡
©ÎªÌ¨S¦³¤W¶Çªþ¥ó¡A·R²ö¯à§U

TOP

        ÀR«ä¦Û¦b : ¡i¬°µ½Ävª§¡j¤H¥Í­n¬°µ½Ävª§¡A¤À¬í¥²ª§¡C
ªð¦^¦Cªí ¤W¤@¥DÃD