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

[µo°Ý] Ãö³¬Àɮתº»yªk

[µo°Ý] Ãö³¬Àɮתº»yªk

¤j¤j­Ì,½Ð«ü±Ð¦sÀɪº»yªk¦p¤U:
1) ¥H¤UÀɮ׻ݭn¦s¬°PO_Report.xlsx«áÃö³¬,¤£ª¾¦³¨S¦³¨ä¥¦ªº¼gªk?
ActiveWorkbook.SaveAs "P:\Interim\PO_Report.xlsx"
    Workbooks("P:\Interim\PO_Report.xlsx").Close True

¦pªGÀÉ®×°õ¦æ§¹«ü¥O«á¤£»Ý­n¦sÀɧY­n¥¦±j¨îÃö³¬¤S¬O«ç»ò¼gªk?

¦^´_ 1# PJChen
Workbooks("P:\Interim\PO_Report.xlsx").Close False  
VBAªº»¡©ú :
®M¥Î¦Ü Workbook ª«¥ó®É¥Î Close ¤èªk¡C
Ãö³¬ª«¥ó¡C
expression.Close(SaveChanges, Filename, RouteWorkbook)
expression     ¥²¿ï¡C¸Ó¹Bºâ©Î·|¶Ç¦^¤W­z¨ä¤¤¤@­Óª«¥ó¡C
SaveChanges     ¿ï¾Ü©Êªº Variant¡C¦pªG¬¡­¶Ã¯¥¼µo¥ÍÅܧó¡A«h©¿²¤³o­Ó¤Þ¼Æ¡C¦pªG¬¡­¶Ã¯¦³Åܧó¡B¨Ã¥B¥X²{¦b¨ä¥L¶}±Òªºµøµ¡¤¤¡A«h©¿²¤³o­Ó¤Þ¼Æ¡C¦pªG¬¡­¶Ã¯¦³Åܧó¡A¦ý¨S¦³Åã¥Ü¦b¨ä¥L¥ô¦ó¶}±Òªºµøµ¡¤¤¡A«h¦¹¤Þ¼Æ±N«ü©w¬O§_À³Àx¦sÅܧó¡A¦p¤Uªí©Ò¥Ü¡C
­È §@·~
True ±N§ïÅÜÀx¦s¨ì¬¡­¶Ã¯¡C¦pªG¸Ó¬¡­¶Ã¯©|¥¼©R¦W¡A«h¨Ï¥Î FileName ©Ò«ü©wªº¦WºÙ¡C¦pªG¬Ù²¤ FileName¡A«h­n¨D¨Ï¥ÎªÌ¿é¤JÀɮצWºÙ¡C
False ¤£±N§ïÅÜÀx¦s¨ì¦¹ÀɮסC
¬Ù²¤ Åã¥Ü¹ï¸Ü¤è¶ô¡A­n¨D¨Ï¥ÎªÌ¨M©w¬O§_Àx¦s©Ò§@ªºÅܧó¡C
FileName     ¿ï¾Ü©Êªº Variant¡C¥H¦¹ÀɮצWºÙÀx¦s©Ò§@ªºÅܧó¡C
RouteWorkbook     ¿ï¾Ü©Êªº Variant¡C¦pªG«ü©w¬¡­¶Ã¯¤£»Ý­n¶Ç¿éµ¹¤U¤@­Ó¦¬¥óªÌ (¨S¦³¶Ç¿é¦W³æ©Î¤w¸g¶Ç¿é)¡A«h©¿²¤¸Ó¤Þ¼Æ¡C§_«h¡AMicrosoft Excel ±N«ö·Ó¤U¦Cªí®æ©Ò¥Ü³B²z¶Ç¿é¤u§@ï¡C

TOP

¦^´_ 2# GBKEE


·PÁÂ!±j¨îÃö³¬Àɮפ@¸Õok.
½Ð°Ý¥ý¦s¦¨PO_Report.xlsx¦AÃö³¬ÀÉ®×,³o¤G¦æ¦³¨S¦³¦X¨Öªº¼gªk?
ActiveWorkbook.SaveAs ":\Interim\PO_Report.xlsx"
Workbooks(":\Interim\PO_Report.xlsx").Close True

TOP

¦^´_ 3# PJChen
  1. Option Explicit
  2. Sub Ex()
  3.    With ActiveWorkbook   '§@¥Î¤¤ªº¬¡­¶Ã¯
  4.     .SaveAs "P:\Interim\PO_Report.xlsx"
  5.     .Close True
  6.    End With
  7. End Sub
  8. Sub Ex1()
  9.   With Workbooks("«ü©w.xlsx")  '«ü©wªº¬¡­¶Ã¯
  10.     .SaveAs "P:\Interim\PO_Report.xlsx"
  11.     .Close True
  12.   End With
  13. End Sub
½Æ»s¥N½X

TOP

¦^´_ 4# GBKEE

ÁÂÁ±zªº«ü¾É

TOP

½Ð±Ð¤@¤U¡G
        .SaveAs "P:\Interim\PO_Report.xlsx"
        .Close True
¬°¦ó¤£¥[ =  ¦r¤¸©O¡H ¦p
        .SaveAs = "P:\Interim\PO_Report.xlsx"
        .Close = True

TOP

¦^´_ 6# c_c_lai
SaveAs ,Close  ³£¬OVBAªº¤èªk, Äݩʤ~¶·¥Î = ¨Ó½á¤©Äݩʪº­È , ½Ð¦h¦h¬Ý¬Ý»yªk ¤Î»¡©úªº½d¨Ò.·|¶i¨Bªº

TOP

        ÀR«ä¦Û¦b : ¤H­n¦Û·R¡A¤~¯à·R´¶¤Ñ¤Uªº¤H¡C
ªð¦^¦Cªí ¤W¤@¥DÃD