我在G列中列出了其他工作簿的工作簿
Folder\File1.xls
Folder\File2.xls
Folder\File3.xls
Folder\File4.xls
以下vba代码从所有这些工作簿中的单元格C15获取电子邮件地址,并将它们添加到列U中,如下所示:
Folder\File1.xls Email
Folder\File2.xls Email
Folder\File3.xls Email
Folder\File4.xls Email
这是我的代码。
'//Email copy code
Dim startCell As Range, fileRng As Range
Dim files As Variant, values() As Variant, values2() As Variant
Dim path As String, file As String, arg As String
Dim r As Long, i As Long
'Acquire the names of your files
With ThisWorkbook.Worksheets(1) 'amend to your sheet name
Set startCell = .Range("G17") 'amend to start cell of file names
Set fileRng = .Range(startCell, .Cells(.Rows.Count, startCell.Column).End(xlUp))
End With
files = fileRng.Value2
'Size your output array
ReDim values(1 To UBound(files, 1), 1 To 1)
'Populate output array with values from workbooks
For r = 1 To UBound(files, 1)
'Create argument to read workbook value
i = InStrRev(files(r, 1), "\")
path = Left(files(r, 1), i)
file = Right(files(r, 1), Len(files(r, 1)) - i)
arg = "'" & path & "[" & file & "]Sheet1'!R15C3"
'Acquire the value
values(r, 1) = ExecuteExcel4Macro(arg)
Next
'Write values to sheet
fileRng.Offset(, 20).Value = values
此代码适用于我家中的Windows笔记本电脑。但是,在工作中,我的IT部门禁止使用CMD和其他shell函数 - 我相信这些代码用来从工作簿中获取值。
因此,此代码无法从C15列中获取值。
任何人都可以给我一个解决方法吗?感谢
答案 0 :(得分:0)
这个解决方法怎么样:
java.lang.RuntimeException: org.mule.api.config.ConfigurationException: Error creating bean with name 'Test_flow': Cannot create inner bean '(inner bean)#6a12c7a8' of type [com.mulesoft.module.batch.BatchInputBlock] while setting bean property 'inputBlock'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#6a12c7a8': Cannot create inner bean '(inner bean)#1d408060' of type [org.mule.config.spring.factories.PollingMessageSourceFactoryBean] while setting bean property 'messageSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#1d408060': Cannot create inner bean '(inner bean)#1a500561' of type [com.sungardas.osstools.modules.servicenowrest.generated.processors.SysHistorySetQueryAllValuesMessageProcessor] while setting bean property 'messageProcessor'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name '(inner bean)#1a500561': Cannot resolve reference to bean 'ServiceNowREST__Default_Configuration' while setting bean property 'moduleObject'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'ServiceNowREST__Default_Configuration' is defined (org.mule.api.lifecycle.InitialisationException)
at org.mule.munit.runner.mule.SuiteRunner.<init>(SuiteRunner.java:59)
at org.mule.munit.runner.mule.SuiteRunner.<init>(SuiteRunner.java:45)
at org.mule.munit.remote.RemoteRunner.runTestSuite(RemoteRunner.java:75)
at org.mule.munit.remote.RemoteRunner.run(RemoteRunner.java:55)
at org.mule.munit.remote.RemoteRunner.main(RemoteRunner.java:39)
这会有用吗?它产生了什么?它应该产生什么?