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

*.exe ±ý¨ú±o¥»¨­¤§ÀɦWÀ³¦p¦ó¤U»yªk

*.exe ±ý¨ú±o¥»¨­¤§ÀɦWÀ³¦p¦ó¤U»yªk

½Ð±Ð½Ñ¦ì¥ý¶i:
Sub Main()
    Dim objXLApp
    Dim objXLBook
     Dim fso3
    Set fso3 = CreateObject("Scripting.FileSystemObject")
    GetAn3 = fso3.GetbaseName(myself)
    MsgBox GetAn3
  End Sub
¥H¤WÂର*.exe   ±ý¨ú±o¥»¨­¤§ÀɦW myselfÀ³¦p¦ó¤U»yªk

GetbaseName¸Ì­±¬O©ñ¸ô®|...
¤p§Ì·M¬N ¤£¤F¸Ñ±z´£°Ýªº"¥H¤WÂର*.exe"...
­Y¬O§Ú¦^µª¡A¨Ï±zº¡·N¡A½Ð±zÅý§Úª¾¹D¡I                  
­Y¬O§Úªº¦^ÂСA±z¤´¦³¨ä¥L¨£¸Ñ¡A¤]½Ð±z¤£¶Þ«ü±Ð¡I

TOP

¥»©«³Ì«á¥Ñ yangjie ©ó 2010-11-5 23:53 ½s¿è

·PÁÂ Min ¤j¤j
¤w¦bVB°ÏÅý±zµ¹¸Ñ¨M¤F  f1 = App.EXEName  f1 ´N¬OBaseName
¥H¤U¥þ¤å¨Ñ¤j®a°Ñ¦Ò Âন°õ¦æÀÉ*.exe«á¥i¥H¶}¦PÀɦWªº*.xls
¤£¥Î¦A¥h²z·|¦w¥þ©Ê¼h¯Å°ÝÃD
Sub Main()
    Dim f1
    f1 = App.EXEName
    Dim fso, f As Object
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set f = fso.GetFile(f1 & ".xls")
    Dim n
    n = fso.GetParentFolderName(f.Path)
    Set objXLApp = CreateObject("Excel.Application")
    objXLApp.Visible = True
    Set objXLBook = objXLApp.Workbooks.Open(n & "\" & f1 & ".xls")
    Set objXLBook = Nothing
    Set objXLApp = Nothing
    Set fso = Nothing
    Set n = Nothing
    Set f = Nothing
End Sub

TOP

¨þ¨þ¨þ~
­ì¨Óyangjie¥S¬O·Q¶¹LEXCEL VBA¦w¥þ©Ê ¶}±ÒEXCEL...
³o­Ó§Ú¤]°µ¹L ¤£¹L§Ú¬O¥ÎVBS
¨ä¤è¦¡³£¬O»P±zªº¤j¦P¤p²§~
­Y¬O§Ú¦^µª¡A¨Ï±zº¡·N¡A½Ð±zÅý§Úª¾¹D¡I                  
­Y¬O§Úªº¦^ÂСA±z¤´¦³¨ä¥L¨£¸Ñ¡A¤]½Ð±z¤£¶Þ«ü±Ð¡I

TOP

¥»©«³Ì«á¥Ñ yangjie ©ó 2010-11-6 11:45 ½s¿è

¦^´_ 4# Min


    ¤£¦n·N«äÅýMin¥S¨£¯º¤F¡B¡B¡B
¨ä¥D­n¬Ù¤U敎¹ïPC¤£«Ü¼ô¦³ÃöMacroªº¨Æ¡A
¥H«e¤]¬O¥ÎVBS³B²z¡C
¤@¥¹§ïÀɦW¡A«hVBS¤º®e¤]­n§ï¡A¤~·Q¥Î*.exe
¶¶¹D½Ð±Ð1:
¦p¦ó§@ªk?  Åý¥L¤H«D±o¥Î*.exe¤~¶}±o¤F§Úªº*.xls   
§_«h·|application.quit

¶¶¹D½Ð±Ð2:
¥H«e¥Î¹L*.xls  ¥h³]©w Excelµ{¦¡   ·Q¦b*.exe¤º°õ¦æ¥H¤U"³]©wExcel"
VBÀ³¦p¦ó¼gªk
Private Sub Workbook_Open()
    yangan = GetSetting(appname:="yangApp", section:="Startup1", key:="¨Ï¥Î½T»{", Default:=88)
    SaveSetting "yangApp", "Startup1", "¨Ï¥Î½T»{", yangan

   Application.Quit
End Sub

TOP

1.
½Ð°Ý±zªº¥Øªº¬O¤°»ò? ­n¥Îexcel ¤S¤£Åý¤H®a¶}excel.... ¦nÁ}²`ªº°ÝÃD>"<
¦pªG±zªº¥Øªº¥u¬O­nÅýusers¨S¦³¶}±Ò¥¨¶° ´N¬Ý¤£¨ì¸ê®Æ ¨ºª½±µ¨ìexcel°Ï¯Ò¤å ´N¥i¥H§ä¨ì¬ÛÃöªº¤å³¹..
¤£¹LµL½×¬O­þ¤@ºØ¤è¦¡ ³£·|¦³º|¬}... Excel ¶i¶¥°ÏªºHUNGCHILINª©¥D ´Nµo¦n¦hÃþªº¤å³¹..

2.
±z«e­±¤£¬O´N¦³¼g¨ì Set objXLApp = CreateObject("Excel.Application") ...
­n¤Þ¥Îexcel¶i¨Ó ¤~¥i¥H¨Ï¥Îexcel¥\¯à~

ÁÙ¦³VBS¤£»Ý­n¸òµÛ§ïÀɦW³á... µ½¥Î¤@¤U¨ç¼Æ^^
Replace(Wscript.ScriptFullName, Right(Wscript.ScriptFullName, 4), ".xls")
­Y¬O§Ú¦^µª¡A¨Ï±zº¡·N¡A½Ð±zÅý§Úª¾¹D¡I                  
­Y¬O§Úªº¦^ÂСA±z¤´¦³¨ä¥L¨£¸Ñ¡A¤]½Ð±z¤£¶Þ«ü±Ð¡I

TOP

¦^´_ 6# Min


    Replace(Wscript.ScriptFullName, Right(Wscript.ScriptFullName, 4), ".xls")
¥i§_¥ý¨ú±o  am=Wscript.ScriptFullName
                  Replace(am, Right(am, 4), ".xls")

§Ú¹Á¸Õ¬Ý¬Ý    ÁÂÁÂ

TOP

        ÀR«ä¦Û¦b : ¦³¦h¤Ö¤O¶q´N°µ¦h¤Ö¨Æ¡A¤£­n¤ß¦sµ¥«Ý¡Aµ¥«Ý¤~·|¸¨ªÅ¡C
ªð¦^¦Cªí ¤W¤@¥DÃD