麻烦高手帮个小忙,转换下这个宏代码(10分)

  • 主题发起人 主题发起人 dssj
  • 开始时间 开始时间
D

dssj

Unregistered / Unconfirmed
GUEST, unregistred user!
把这段代码转化为delphi代码。谢谢
Selection.InlineShapes.AddOLEObject ClassType:="Excel.Sheet.8", FileName:= _
"F:/Excel/Demo1.xls", LinkToFile:=False, DisplayAsIcon:=False
 
如果分数不够啊。。呵呵。。可以加[:)]
 
var
WordObject : TWordObject;
ClassType,FileName,LinkToFile,DisplayAsIcon:olevariant;
IconFileName,IconIndex,IconLabel,Range:olevariant;
begin
ClassType:='Excel.Sheet.8';
FileName:='F:/Excel/Demo1.xls';
LinkToFile:=False;
DisplayAsIcon:=False;
IconFileName:='_';
IconIndex:=0;
IconLabel:='';
Range:=WordObject.Application.Selection.Range;
wordobject.Application.Selection.InlineShapes.AddOLEObject(ClassType,FileName,LinkToFile,DisplayAsIcon,IconFileName,IconIndex,IconLabel,Range);
执行之后出现。。。命令失败。。
请问是哪个地方出现问题了?谢谢
 
经过调试,得知是IconIndex原因。如果没有icon,那IconIndex的值应该设为什么呢

谢谢
 
晕。。。没人理会
 
IconIndex
Optional Object. The index number of the icon within IconFileName. The order of icons in the specified file corresponds to the order in which the icons appear in the Change Icon dialog box (Insert menu, Object dialog box) when the Display as icon check box is selected. The first icon in the file has the index number 0 (zero). If an icon with the given index number doesn't exist in IconFileName, the icon with the index number 1 (the second icon in the file) is used. The default value is 0 (zero).

照着上面做了,还是有问题
 
已经解决
 

Similar threads

S
回复
0
查看
3K
SUNSTONE的Delphi笔记
S
S
回复
0
查看
2K
SUNSTONE的Delphi笔记
S
I
回复
0
查看
697
import
I
后退
顶部