A
AlbertYWang
I have an application where I am using an Excel 2000 workbook as a
master document to contain other documents( .xls, .doc, .rtf, .txt,
..ppt, .msg, ...) for review. I want to be able to open an embedded
file in it's original application.
I have figured out how to do this manually by inserting an object
created from a file, and displaying as an icon. I can also change the
size of the icon to fit within a cell.
By using the macro recorder and VBA, I have figured out how to start an
open file dialog, embed an arbitrary Excel file and resize the icon
with:
sFilename = Application.GetOpenFilename("All files (*.*), *.*")
Workbooks.Open Filename:=sFilename
ActiveWindow.Visible = False
ActiveSheet.OLEObjects.Add(Filename:= _
sFilename, Link:=False, _
DisplayAsIcon:=True, IconFileName:= _
"C:\WINNT\Installer\{00020409-78E1-11D2-B60F-006097C998E7}\xlicons.exe",
_
IconIndex:=0, IconLabel:= _
sFilename).Select
Selection.ShapeRange.LockAspectRatio = msoFalse
Selection.ShapeRange.Height = 11.25
Selection.ShapeRange.Width = 48#
But this doesn't work with other file types( e.g. - .doc, .ppt, ...).
How can I generalize this to work with arbitrary file types?
Albert Wang
master document to contain other documents( .xls, .doc, .rtf, .txt,
..ppt, .msg, ...) for review. I want to be able to open an embedded
file in it's original application.
I have figured out how to do this manually by inserting an object
created from a file, and displaying as an icon. I can also change the
size of the icon to fit within a cell.
By using the macro recorder and VBA, I have figured out how to start an
open file dialog, embed an arbitrary Excel file and resize the icon
with:
sFilename = Application.GetOpenFilename("All files (*.*), *.*")
Workbooks.Open Filename:=sFilename
ActiveWindow.Visible = False
ActiveSheet.OLEObjects.Add(Filename:= _
sFilename, Link:=False, _
DisplayAsIcon:=True, IconFileName:= _
"C:\WINNT\Installer\{00020409-78E1-11D2-B60F-006097C998E7}\xlicons.exe",
_
IconIndex:=0, IconLabel:= _
sFilename).Select
Selection.ShapeRange.LockAspectRatio = msoFalse
Selection.ShapeRange.Height = 11.25
Selection.ShapeRange.Width = 48#
But this doesn't work with other file types( e.g. - .doc, .ppt, ...).
How can I generalize this to work with arbitrary file types?
Albert Wang