我有一个Outlook宏,可以根据搜索电子邮件收件箱来保存附件。然后打开聚合文件,然后循环打开第一个保存的附件并复制" AggregateThis"命名范围。 我需要实现的是: 1)。激活聚合文件 2)。激活搜索结果的行" END"位于 3)。将复制的单元格插入到结尾
之上Outlook对象模型给我带来麻烦,这将是Excel VBA中的完全收获。你的帮助意味着很多!
Dim xlApp As Object
Set xlApp = CreateObject("Excel.Application")
With xlApp
.Visible = True
.EnableEvents = False
.DisplayAlerts = False
.ScreenUpdating = False
.Workbooks.Open ("J:\Retail Finance\Varicent\General Teamshare Resources\Acting Mgr Assignment Bonus Aggregation.xlsx")
Dim x As Variant
i = -1
For Each x In AttachNames
Dim wb As Object
i = i + 1
Set wb = .Workbooks.Open("J:\Retail Finance\Varicent\General Teamshare Resources\Teamshare AAA\" & AttachNames(i))
Set wb = .Worksheets("Additional Assignment Bonus FRM")
'Copies the "Aggregate This" named range from the Individual File (i)
With wb.Range("AggregateThis")
.Copy
End With
'Switches focus to Aggregation File
Set wb = .Workbooks("J:\Retail Finance\Varicent\General Teamshare Resources\Acting Mgr Assignment Bonus Aggregation.xlsx")
With wb
.Activate '#1). I want to put focus on this file it throws an error
End With
'Find EndRow in the Aggregation File
Set wb = .Worksheets("Additional Assignment Bonus FRM").Cells.Find("End")
With wb
.ActivateRow '#2).This throws an error
.PasteSpecialInsertRows '#3). This doesnt work
End With
Next
答案 0 :(得分:0)
原始代码无法正常工作,因为对于.Activate工作,ScreenUpdating必须设置为True(默认为默认值)。
export class Service{
private parent:ElementRef;
constructor(private DynamicComponentLoader:DynamicComponentLoader){
}
setParent(parent){
this.parent = parent.nativeElement;
}
append(){
this.DynamicComponentLoader.loadIntoLocation(ModalComponent, this.parent, 'modal');
}
}