|
-
Apr 8th, 2003, 05:25 PM
#1
Thread Starter
New Member
-
Apr 24th, 2003, 07:57 AM
#2
Addicted Member
Hello there,
could it be that you don't open Word and make it visible ?
Here's a sample of an xl file I attach to an Outlook form.
You should be able to do the same with Word. Have you tried recording a print action. The code generated is almost cut and paste ready.
Code:
Dim oXLApp
Dim oXLSheet
Set xl = CreateObject("Excel.application")
If xl Is Nothing Then
MsgBox "Couldn't start Excel."
Else
xl.Visible = True
Set xlbook = xl.Workbooks.Add
Set xlsheet = xlbook.ActiveSheet
With xlsheet
.Cells(1, 1) = "Type of demand"
.Cells(1, 2) = "Material"
.Cells(1, 3) = "Supplier Reference"
.Cells(1, 4) = "Description"
.Cells(1, 5) = "Current Usage"
.Cells(1, 6) = "New Usage"
.Cells(1, 7) = "Delivery date"
.Cells(1, 8) = "Remarks"
for x=0 to count
if MaterialListArray(x,0) <> "" then
for y=0 to 7
.Cells(x+3,y+1)=MaterialListArray(x,y)
next
end if
next
end with
xlbook.ActiveSheet.SaveAs ("c:\temp\test.xls")
end if
Set xl = Nothing
Set xlbook = Nothing
item.attachments.add "c:\temp\test.xls"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|