PDA

View Full Version : Output using the acOutputFunction type



talytech
03-09-2011, 07:22 AM
I would like to set up a variable that contains HTML and then use the Output acOutputfunction type to send the data to MS Word. When I do a simple test just to send a plain text variable I get an error.

I have a function called "outToWord" and another Function called "sendIt". Here is my code to "outToMSWord":

Function outToMSWord()
Dim x As String
x = "This is a test."
End Function

Here is my code to "sendIt"

Function sendIt()
DoCmd.OutputTo acOutputFunction, "outToMSWord", acFormatRTF, "C:\Documents and Settings\e3utbl\Desktop\FTPTest\Tasha.doc", -1
End Function

When I run that function I get a runtime error '3011': The Microsoft Jet Database Engine couldn't find the object "outToMSWord".

Any ideas?

SoftwareMatt
03-10-2011, 04:09 AM
Because it is a function you need to remove the quotes as below:

DoCmd.OutputTo acOutputFunction, outToMSWord(), acFormatRTF

talytech
03-10-2011, 10:34 AM
Thank you. It works now.