我正在尝试创建一个宏,用于识别个人银行家的投资组合。宏将过滤银行家的名称(仅显示他们的投资组合),并将PDF和银行家的名称放在PDF文件中。宏运行没有任何错误。它能够识别银行家,添加到集合中,并通过所有银行家进行过滤。但是,它没有任何PDF。我无法确定问题所在。请帮忙!
我的代码:
Sub CreatePDFs()
'
' CreatePDFs Macro
'
' Identify distinct banker names in Column E and store in a collection
Dim BankerCollection As Collection
Dim Banker As Variant
Dim Rng As Range
Dim Cell As Range
Set Rng = Range("E5", Range("E5").End(xlDown))
Set BankerCollection = New Collection
On Error Resume Next
For Each Cell In Rng.Cells
BankerCollection.Add Cell.Value, CStr(Cell.Value)
Next Cell
' Loop through each banker name in the collection
For Each Banker In BankerCollection
' Copy each banker name to cell B1
Range("B1").Value = Banker
Range("B1").Font.Bold = True
' filter on the banker name, and PDF with banker name in document title
Range("E4", Range("E4").End(xlDown)).AutoFilter Field:=1, Criteria1:=Banker, VisibleDropDown:=False
ThisFile = Banker + " Portfolio"
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=ThisFile, OpenAfterPublish:=True
Next Banker
End Sub
答案 0 :(得分:-1)
更改代码的这一行
ThisFile = Banker & " Portfolio"
用这个
<input type="radio" name="03794" class="js-sourcing-option" data-sourcingoption="">
<script type="text/javascript">
var Obj = {'hasBackOrder':true,
'isPartial':false,
'unsourcedQty':0,
'warehouseSequences':[1],
'shipments': {
'SomeName': {
'warehouseNumber':101,
'deliverByTime':'2017-10-12T17:00:00',
'numShipments':0,
'warehouseQty':0,
'backorderQty':1,
'qtyByWarehouseInStock': {}
,
'qtyByWarehouseBackorder': {
'101': 1
}
}
}
,
'sourcedQty':1,
'shouldDisplay':true
}
var element = $('.js-sourcing-option').attr('data-sourcingoption', Obj);
console.log(Obj.shipments.SomeName.deliverByTime);
P.S事实证明,如果没有更改,您无需进行此更改,您的代码可以正常运行。