-
OK, that wasn't real code, to see if a file existed which I was generating.
As previously mentioned ProE can take a while to churn out a PDF file, so I have to wait until this is done. I have used a time delay to do this:
[vba]
(in main sub)
fnWait(120)
(at end of main sub)
Public Function fnWait(intNrOfSeconds As Integer)
Dim varStart As Variant
varStart = Timer
Do While Timer < varStart + intNrOfSeconds
Loop
End Function
[/vba]
This was unfortunate, as I had to leave the Outlook Frozen in sleep mode for a long enough period that it would definately have the PDF generated.
I now use this short line of code to make sure the file exists:
[VBA]
Dim PDFname As String
PDFname = "C:\ProE\stell_ga.pdf"
Do
Loop Until Dir(PDFname, vbNormal) <> ""
item.Attachments.Add (PDFname)
item.Attachments.Add ("C:\ProE\stl_param.txt")
[/VBA]
It hits a Do Loop and stays there until the DIR command finds something matching the filename of the PDF that ProE is generating.
Then it will email me the results. I'm sorry but this code is still incomplete, as I'm still in there and it's very messy, but I thought this method of waiting until a file has been generated would help someone.
It might be better to have a ten second pause in the routine so the disc interface card isn't constently interrogating the same directory whilst you're trying to write a PDF to it, this could be done by combining the two routines.
-AS
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