VBA方式选择文件然后选择目标文件夹

时间:2015-10-28 08:43:05

标签: vba powerpoint-vba filepicker

我正在尝试选择一堆文件,使用:

Set fd = Application.FileDialog(msoFileDialogFilePicker)

然后我必须处理每个选定的文件(我允许多个选择)并将其写回目标目录。 我的问题是,当我使用时:

Set destFolder = Application.FileDialog(msoFileDialogFolderPicker)

选择目标文件夹,fd被覆盖,因为Application对象只能实例化单个FileDialog对象。然后我从SelectedItems中删除了fd列表。

我该怎么做才能保留列表进行迭代?

1 个答案:

答案 0 :(得分:0)

只需保存fd。

返回的SelectedItems列表
try below code...
eventStore = [[EKEventStore alloc] init];
   // Create a new event object.
    EKEvent *event = [EKEvent eventWithEventStore: eventStore];

    // Set the event title.
    event.title = eventMessage;

    // Set its calendar.


    NSString *identifier=[[NSUserDefaults standardUserDefaults]objectForKey:@"calenderId"];
     // NSLog(@"cal identifier: %@",identifier);
    event.calendar = [eventStore calendarWithIdentifier:identifier];

    //set Alarm
    NSTimeInterval secondsInOneHours = 1 * 60 * 60;

    NSDate *dateOneHoursAhead = [eventDate dateByAddingTimeInterval:secondsInOneHours];

    // Set the start and end dates to the event.
    event.startDate = eventDate;
    event.endDate = dateOneHoursAhead; //

NSError *error;
    if ([eventStore saveEvent:event span:EKSpanFutureEvents commit:YES error:&error]) {

      / NSLog(@"Event Added");
    }
    else{
         An error occurred, so log the error description.
        NSLog(@"%@", [error localizedDescription]);
    }
相关问题