|
임문환.실업자 님이 쓰신 글 :
: 박상윤 님이 쓰신 글 :
: : key값을 argument에 표시하는 방법좀 알려주세요..
: : ....
: : Variant ER = ESheet.PropertyGet("Rows", "1:100");
: :
: : ER.OldProcedure("Sort", .....????)
:
: Excel에서 도움말을 찾아보면 아래와 같이 나와 있습니다.
: expression.Sort(Key1, Order1, Key2, Type, Order2, Key3, Order3, Header, OrderCustom, MatchCase, Orientation, SortMethod, DataOption1, DataOption2, DataOption3)
:
: 한편, Excel에서는 해당 작업을 프로그램으로 어떻게 처리해야 하는지 잘 모르는 경우,
: [도구]->[매크로]->[새 매크로 기록...]을 선택하면 나타나는 창에 원하는 매크로 이름을 입력한 후 하고 싶은 작업을 하면 VBA 코드로 기록이 됩니다.
: 그 코드는 [도구]->[매크로]->[매크로...]을 선택하면 나타나는 창에서 해당 매크로를 선택한 후 [편집] 단추를 선택하면 볼 수 있습니다.
:
: Sort의 예는 아래와 같습니다.
:
: //#include "excel_2k.h"
: //#include "excel_xp.h"
:
: xlApp = Variant::CreateObject("Excel.Application");
: xlApp.OlePropertySet("DisplayAlerts", false);
: xlApp.OlePropertySet("Visible", false);
: xlBooks = xlApp.OlePropertyGet("Workbooks");
: xlBook = xlBooks.OleFunction("Open",fileName);
: xlSheets = xlBook.OlePropertyGet("Worksheets");
: xlSheet = xlSheets.OlePropertyGet("Item", 1);
: xlRange = xlSheet.OlePropertyGet("Range", xlSheet.OlePropertyGet("Cells", 1, 1), xlSheet.OlePropertyGet("Cells", 8, 1));
: xlKey1 = xlSheet.OlePropertyGet("Range", xlSheet.OlePropertyGet("Cells", 1, 1), xlSheet.OlePropertyGet("Cells", 1, 1));
: xlRange.OleFunction("Select");
: xlRange.OleFunction("Sort"
: ,xlKey1,xlAscending
: ,Variant::NoParam(),Variant::NoParam(),Variant::NoParam()
: ,Variant::NoParam(),Variant::NoParam()
: ,xlGuess, 1, false, xlTopToBottom,Variant::NoParam()
: );
임문환님 감사드립니다.
|