J
JoAnn
I have a macro that prints all doc attachments that are
embedded as objects in a Word 2000 document (code provided
at end of doc). I have it set to to skip those with PROG
ID of "package" but print all others (like Excel spread
sheets , other Word docs, etc.).
It works fine for Word docs but I have 2 problems:
1. It doesn't print Excel spreadsheets even though they do
not appear with and ProgID of "package". I suspect I need
to switch control somehow to Excel to open the sheet then
print then close it but I'm not sure if that is true
and/or if there is an easier way. Also, I don't know how
to do this if it is needed.
2. I also want to be able to print items with .txt
extensions but they have an ID of "package". Any one know
how I can do that programmatically?
Thanks for your help!
JoAnn
Here is mycode:
Sub PRINT_Attachments()
'
' PRINT_Attachments Macro -- to print attachments in a doc
'
x = 0
x = ActiveDocument.InlineShapes.Count
Do While x <> 0
If ActiveDocument.InlineShapes(x).Type = 1 Then
If ActiveDocument.InlineShapes(x).OLEFormat.ProgID
<> "Package" Then
ActiveDocument.InlineShapes(x).Activate
ActiveWindow.PrintOut
ActiveWindow.Close
End If
End If
x = x - 1
Loop
End Sub
embedded as objects in a Word 2000 document (code provided
at end of doc). I have it set to to skip those with PROG
ID of "package" but print all others (like Excel spread
sheets , other Word docs, etc.).
It works fine for Word docs but I have 2 problems:
1. It doesn't print Excel spreadsheets even though they do
not appear with and ProgID of "package". I suspect I need
to switch control somehow to Excel to open the sheet then
print then close it but I'm not sure if that is true
and/or if there is an easier way. Also, I don't know how
to do this if it is needed.
2. I also want to be able to print items with .txt
extensions but they have an ID of "package". Any one know
how I can do that programmatically?
Thanks for your help!
JoAnn
Here is mycode:
Sub PRINT_Attachments()
'
' PRINT_Attachments Macro -- to print attachments in a doc
'
x = 0
x = ActiveDocument.InlineShapes.Count
Do While x <> 0
If ActiveDocument.InlineShapes(x).Type = 1 Then
If ActiveDocument.InlineShapes(x).OLEFormat.ProgID
<> "Package" Then
ActiveDocument.InlineShapes(x).Activate
ActiveWindow.PrintOut
ActiveWindow.Close
End If
End If
x = x - 1
Loop
End Sub