我运行了一个宏,如下所示:
Sub Macro1()
'
' Macro1 Macro
'
'
Range("D7").Select
ActiveSheet.OLEObjects.Add(Filename:= _
"C:\Documents and Settings\rakshiar\Desktop\\Operating+System+Concepts.pdf" _
, Link:=False, DisplayAsIcon:=True, IconFileName:= _
"C:\WINDOWS\Installer\{AC76BA86-7AD7-FFFF-7B44-AB0000000001}\PDFFile_8.ico", _
IconIndex:=0, IconLabel:="Operating+System+Concepts.pdf").Select
End Sub
并尝试将其转换为VBScript代码,如下所示:
excel = WIN32OLE.new('Excel.Application')
excel.visible = true
wb=excel.workbooks.open("E:\\WIPData\\Ruby\\Scripts\\GSL_File_DownLoad.xlsx")
wbs= wb.Worksheets(1)
wbs.cells(rows,2).values = wbs.OLEObjects.Add(,full_path,False,True, IconFileName:= _
"C:\WINDOWS\Installer\{AC76BA86-7AD7-FFFF-7B44-AB0000000001}\PDFFile_8.ico",_
IconIndex:=0,"Operating+System+Concepts.pdf")
但现在无法理解如何以及如何提出IconIndex
和IconFileName
论点?
我有 .pdf、.tif、.docs、docx、.gif 等扩展文件,我需要使用脚本将它们附加到 Excel 列。那么在运行时我将如何获得"C:\WINDOWS\Installer\{AC76BA86-7AD7-FFFF-7B44-AB0000000001}\PDFFile_8.ico"
.pdf 文件的值?
请在这里帮助我。