Hello
Huge amount to absorb here and more than I have time for, unfortunately. I would like to help because e-mailing out of Excel and Access is something I have to do. Would it be possible for you to distil the problem down?
Hello
Huge amount to absorb here and more than I have time for, unfortunately. I would like to help because e-mailing out of Excel and Access is something I have to do. Would it be possible for you to distil the problem down?
David
Access and Excel Developer | UK
Hi,
Thanks for your response, basically I want to pass through the string for a word document that is created and closed in one module, and then reopen the document later on in a different module. I have played a little since I first posted and I seem to be able to pass the string through as I have got it to attach that document in my email module.
The problem I am having is that I have passed it through to my ping module but cannot reopen the file in that module this is my code for the ping module. Basically I'm looking at if the ping fails then it will open the document, then once the document is open I want it to display the print option.
This is the bit where I can't seem to get the passed string to work, not sure if its my pass or if its me coding opening the doc wrong?![]()
Sub ping(DocFile As String, xFile As String) Dim nRes Dim x Dim FileDoc As String Dim FileX As String Set WordApp = CreateObject("Word.Application") With CreateObject("WScript.Shell") nRes = .Run("%comspec% /c ping.exe -n " & 1 & " -w " & 250 _ & " 192.168.0.5 | find ""TTL="" > nul 2>&1", 0, True) End With If nRes <> 0 Then MsgBox ("Unable to connect to the mail server." & vbNewLine & vbNewLine _ & "Please print off the word document if you haven't already done so " & vbNewLine _ & "and give it the Authorisor. The file can be found in a folder " & vbNewLine _ & "called 'STAFF CHANGES BACKUP' on your desktop. Alternative email " & vbNewLine _ & "both the excel file and word document relating to this request to " & vbNewLine _ & "the Authorisor") WordApp.documents.Open DocFile opdoc: If WordApp Is Nothing Then GoTo opdoc Else x = MsgBox("Would you like to print the change request?", vbQuestion + vbYesNo, "PRINT CHANGE REQUEST") If x = vbYes Then WordDoc.PrintOut Exit Sub Else Exit Sub End If End If Else FileDoc = DocFile FileX = xFile Call Emailer.EMAILLIST(FileDoc, FileX) End If End Sub
![]()
WordApp.documents.Open DocFile opdoc: If WordApp Is Nothing Then GoTo opdoc Else x = MsgBox("Would you like to print the change request?", vbQuestion + vbYesNo, "PRINT CHANGE REQUEST") If x = vbYes Then WordDoc.PrintOut Exit Sub Else Exit Sub End If End If
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks