Custom form created in 2003 won't print since upgrade to 2007

  • Thread starter Thread starter TG9yaV9DQg
  • Start date Start date
Status
Not open for further replies.
T

TG9yaV9DQg

We created multiple Outlook forms that print to Word templates via code in a

Print button. The forms were created in 2003. We recently upgraded to 2007.

Now, when we click the button, the Word template prints but it doesn't

contain the information from the form.

Any ideas?
 
Code in a print button on the form or in Word? You may want to add MsgBox

statements to the code to help you see how it's branching and executing.

Sue Mosher

"Lori_CB" <Lori_CB> wrote in message

news:722B9CAD-754D-435D-B2DB-3960654B6CD6@microsoft.com...
> We created multiple Outlook forms that print to Word templates via code in
> a
> Print button. The forms were created in 2003. We recently upgraded to
> 2007.
> Now, when we click the button, the Word template prints but it doesn't
> contain the information from the form.

> Any ideas?
 
The code is for the Print button on the Outlook form. It's used to open

Word, populate the Word fields, print the document and close Word.

"Sue Mosher [MVP]" wrote:


> Code in a print button on the form or in Word? You may want to add MsgBox
> statements to the code to help you see how it's branching and executing.
> > Sue Mosher
> > >

> "Lori_CB" <Lori_CB> wrote in message
> news:722B9CAD-754D-435D-B2DB-3960654B6CD6@microsoft.com...
> > We created multiple Outlook forms that print to Word templates via code in
> > a
> > Print button. The forms were created in 2003. We recently upgraded to
> > 2007.
> > Now, when we click the button, the Word template prints but it doesn't
> > contain the information from the form.
> > Any ideas?


>
 
Did you try what I suggested? Or run the code in the script debugger?

Sue Mosher

"Lori_CB" <LoriCB> wrote in message

news:203C0444-F9F5-41E6-A3BC-917081E88651@microsoft.com...
> The code is for the Print button on the Outlook form. It's used to open
> Word, populate the Word fields, print the document and close Word.

> "Sue Mosher [MVP]" wrote:
>
> > Code in a print button on the form or in Word? You may want to add MsgBox
> > statements to the code to help you see how it's branching and executing.
>

>> "Lori_CB" <Lori_CB> wrote in message
> > news:722B9CAD-754D-435D-B2DB-3960654B6CD6@microsoft.com...
> > > We created multiple Outlook forms that print to Word templates via code
> > > in
> > > a
> > > Print button. The forms were created in 2003. We recently upgraded to
> > > 2007.
> > > Now, when we click the button, the Word template prints but it doesn't
> > > contain the information from the form.
> >> > Any ideas?

>

>
>>
 
I tried the msgbox and the fields are getting filled in properly.

When I try to use the Script Debugger, it says the feature is not available

and to run setup again. I'm waiting for a reply from our Help Desk.

"Sue Mosher [MVP]" wrote:


> Did you try what I suggested? Or run the code in the script debugger?
> > Sue Mosher
> > >

> "Lori_CB" <LoriCB> wrote in message
> news:203C0444-F9F5-41E6-A3BC-917081E88651@microsoft.com...
> > The code is for the Print button on the Outlook form. It's used to open
> > Word, populate the Word fields, print the document and close Word.
> > "Sue Mosher [MVP]" wrote:
> >
> >> Code in a print button on the form or in Word? You may want to add MsgBox
> >> statements to the code to help you see how it's branching and executing.
> >
> >> "Lori_CB" <Lori_CB> wrote in message
> >> news:722B9CAD-754D-435D-B2DB-3960654B6CD6@microsoft.com...
> >> > We created multiple Outlook forms that print to Word templates via code
> >> > in
> >> > a
> >> > Print button. The forms were created in 2003. We recently upgraded to
> >> > 2007.
> >> > Now, when we click the button, the Word template prints but it doesn't
> >> > contain the information from the form.
> >> >> > Any ideas?
> >
> >
> >>


>
 
Script debugger is an optional component that may not have been installed;

it definitely won't work on Vista unless you also have Visual Studio. :(

That's why I suggested using MsgBox statements.

What do you mean by "the fields are getting filled in properly" -- the

fields in the Outlook item or the fields in the Word document? What happens

if you change the code so that the Word document displays instead of being

printed?

Sue Mosher

"Lori_CB" <LoriCB> wrote in message

news:255A6EC0-494E-42BE-BA8E-DA73C0556BE2@microsoft.com...
> I tried the msgbox and the fields are getting filled in properly.

> When I try to use the Script Debugger, it says the feature is not
> available
> and to run setup again. I'm waiting for a reply from our Help Desk.

> "Sue Mosher [MVP]" wrote:
>
> > Did you try what I suggested? Or run the code in the script debugger?
>

>> "Lori_CB" <LoriCB> wrote in message
> > news:203C0444-F9F5-41E6-A3BC-917081E88651@microsoft.com...
> > > The code is for the Print button on the Outlook form. It's used to
> > > open
> > > Word, populate the Word fields, print the document and close Word.
> >> > "Sue Mosher [MVP]" wrote:
> >> >> Code in a print button on the form or in Word? You may want to add
> > >> MsgBox
> > >> statements to the code to help you see how it's branching and
> > >> executing.
> > >
>> >> "Lori_CB" <Lori_CB> wrote in message
> > >> news:722B9CAD-754D-435D-B2DB-3960654B6CD6@microsoft.com...
> > >> > We created multiple Outlook forms that print to Word templates via
> > >> > code
> > >> > in
> > >> > a
> > >> > Print button. The forms were created in 2003. We recently upgraded
> > >> > to
> > >> > 2007.
> > >> > Now, when we click the button, the Word template prints but it
> > >> > doesn't
> > >> > contain the information from the form.
 
We have XP Professional, so I'm hoping to get it back. It's another thing

that stopped working after the upgrade. There must be something to tweak.

I did a message box for the Outlook field value and for the Word field

value. Both were correct.

I changed oDoc.PrintOut to oDoc.Display and got the following error message:

"Object doesn't support this property or method: 'oDoc.Display'"

Should I be changing something else too?

Thanks for all your help and patience.

"Sue Mosher [MVP]" wrote:


> Script debugger is an optional component that may not have been installed;
> it definitely won't work on Vista unless you also have Visual Studio. :(
> That's why I suggested using MsgBox statements.

> What do you mean by "the fields are getting filled in properly" -- the
> fields in the Outlook item or the fields in the Word document? What happens
> if you change the code so that the Word document displays instead of being
> printed?
> > Sue Mosher
> > >

> "Lori_CB" <LoriCB> wrote in message
> news:255A6EC0-494E-42BE-BA8E-DA73C0556BE2@microsoft.com...
> >I tried the msgbox and the fields are getting filled in properly.
> > When I try to use the Script Debugger, it says the feature is not
> > available
> > and to run setup again. I'm waiting for a reply from our Help Desk.
> > "Sue Mosher [MVP]" wrote:
> >
> >> Did you try what I suggested? Or run the code in the script debugger?
> >
> >> "Lori_CB" <LoriCB> wrote in message
> >> news:203C0444-F9F5-41E6-A3BC-917081E88651@microsoft.com...
> >> > The code is for the Print button on the Outlook form. It's used to
> >> > open
> >> > Word, populate the Word fields, print the document and close Word.
> >> >> > "Sue Mosher [MVP]" wrote:
> >> >> >> Code in a print button on the form or in Word? You may want to add
> >> >> MsgBox
> >> >> statements to the code to help you see how it's branching and
> >> >> executing.
> >> >
> >> >> "Lori_CB" <Lori_CB> wrote in message
> >> >> news:722B9CAD-754D-435D-B2DB-3960654B6CD6@microsoft.com...
> >> >> > We created multiple Outlook forms that print to Word templates via
> >> >> > code
> >> >> > in
> >> >> > a
> >> >> > Print button. The forms were created in 2003. We recently upgraded
> >> >> > to
> >> >> > 2007.
> >> >> > Now, when we click the button, the Word template prints but it
> >> >> > doesn't
> >> >> > contain the information from the form.


>
 
The object browser (F2 in VBA) is your friend. If you look at the Document

object in the Word library, you'll see that it has no Display method, but it

does have an Activate method and Window.Visible property.

You might want to show enough of your code so we can see how you're creating

the document and printing it. Please DO NOT show all the code for filling

the fields; as you said, it's clear that's working.

Sue Mosher

"Lori_CB" <LoriCB> wrote in message

news:E86D1E0A-899C-45A0-9F97-5A6FC0E10842@microsoft.com...
> We have XP Professional, so I'm hoping to get it back. It's another thing
> that stopped working after the upgrade. There must be something to tweak.

> I did a message box for the Outlook field value and for the Word field
> value. Both were correct.

> I changed oDoc.PrintOut to oDoc.Display and got the following error
> message:
> "Object doesn't support this property or method: 'oDoc.Display'"

> Should I be changing something else too?

> Thanks for all your help and patience.

> "Sue Mosher [MVP]" wrote:
>
> > Script debugger is an optional component that may not have been
> > installed;
> > it definitely won't work on Vista unless you also have Visual Studio. :(
> > That's why I suggested using MsgBox statements.
>

>> What do you mean by "the fields are getting filled in properly" -- the
> > fields in the Outlook item or the fields in the Word document? What
> > happens
> > if you change the code so that the Word document displays instead of
> > being
> > printed?
> > > > Sue Mosher
> > >> >> >
>
>> "Lori_CB" <LoriCB> wrote in message
> > news:255A6EC0-494E-42BE-BA8E-DA73C0556BE2@microsoft.com...
> > >I tried the msgbox and the fields are getting filled in properly.
> >> > When I try to use the Script Debugger, it says the feature is not
> > > available
> > > and to run setup again. I'm waiting for a reply from our Help Desk.
> >> > "Sue Mosher [MVP]" wrote:
> >> >> Did you try what I suggested? Or run the code in the script debugger?
> > >
>> >> "Lori_CB" <LoriCB> wrote in message
> > >> news:203C0444-F9F5-41E6-A3BC-917081E88651@microsoft.com...
> > >> > The code is for the Print button on the Outlook form. It's used to
> > >> > open
> > >> > Word, populate the Word fields, print the document and close Word.
> > >>> >> > "Sue Mosher [MVP]" wrote:
> > >>> >> >> Code in a print button on the form or in Word? You may want to add
> > >> >> MsgBox
> > >> >> statements to the code to help you see how it's branching and
> > >> >> executing.
> > >> >
>> >> >> "Lori_CB" <Lori_CB> wrote in message
> > >> >> news:722B9CAD-754D-435D-B2DB-3960654B6CD6@microsoft.com...
> > >> >> > We created multiple Outlook forms that print to Word templates
> > >> >> > via
> > >> >> > code
> > >> >> > in
> > >> >> > a
> > >> >> > Print button. The forms were created in 2003. We recently
> > >> >> > upgraded
> > >> >> > to
> > >> >> > 2007.
> > >> >> > Now, when we click the button, the Word template prints but it
> > >> >> > doesn't
> > >> >> > contain the information from the form.

>

>
>>
 
The code I've been referring to is in Outlook, not Word.

Here's what I'm doing when trying to display the Word document

(see <<< comments in the code):

Sub cmdPrint_Click()

Set oWordApp = CreateObject("Word.Application")

If oWordApp Is Nothing Then

MsgBox "Couldn't start Word."

Else

Dim oWordApp

Dim oWordDoc

Dim bolPrintBackground

' Open a new document

Set oDoc = oWordApp.Documents.Add

("\\w2kcbutler\data\eforms\pcrenewal2.dot")

' <<< deleted setting the field values

' Get the current Word setting for background printing

bolPrintBackground = oWordApp.Options.PrintBackground

' Turn background printing off

oWordApp.Options.PrintBackground = False

' Print the Word document

'oDoc.PrintOut <<< commented out

oDoc.Display <<< added

' Restore previous setting

oWordApp.Options.PrintBackground = bolPrintBackground

' Close and don't save changes to the document

'Const wdDoNotSaveChanges = 0 <<< commented out

'oDoc.Close wdDoNotSaveChanges <<< commented out

' Close the Word instance

'oWordApp.Quit <<< commented out

' Clean up

Set oDoc = Nothing

Set oWordApp = Nothing

End If

End Sub
 
The code may be in Outlook, but you're using Word objects, so you need to

pay attention to what properties and methods those objects expose. Don't

assume you know what they are; look them up in the object browser.

Did you try using the Activate method I pointed out?

Sue Mosher

"Lori_CB" <LoriCB> wrote in message

news:5480F575-5F33-44F6-B206-B6258FD3C7EA@microsoft.com...
> The code I've been referring to is in Outlook, not Word.

> Here's what I'm doing when trying to display the Word document
> (see <<< comments in the code):
> Sub cmdPrint_Click()
> Set oWordApp = CreateObject("Word.Application")
> If oWordApp Is Nothing Then
> MsgBox "Couldn't start Word."
> Else
> Dim oWordApp
> Dim oWordDoc
> Dim bolPrintBackground

> ' Open a new document
> Set oDoc = oWordApp.Documents.Add
> ("\\w2kcbutler\data\eforms\pcrenewal2.dot")

> ' <<< deleted setting the field values

> ' Get the current Word setting for background printing
> bolPrintBackground = oWordApp.Options.PrintBackground

> ' Turn background printing off
> oWordApp.Options.PrintBackground = False

> ' Print the Word document
> 'oDoc.PrintOut <<< commented out
> oDoc.Display <<< added

> ' Restore previous setting
> oWordApp.Options.PrintBackground = bolPrintBackground

> ' Close and don't save changes to the document
> 'Const wdDoNotSaveChanges = 0 <<< commented out
> 'oDoc.Close wdDoNotSaveChanges <<< commented out

> ' Close the Word instance
> 'oWordApp.Quit <<< commented out

> ' Clean up
> Set oDoc = Nothing
> Set oWordApp = Nothing
> End If
> End Sub
>
 
I tried the Activate and PrintPreview methods. Each time, nothing happened

when I clicked the Outlook Print button.
 
You can also try adding a statement to set the document's

ActiveWindow.Visible property to True.

You might also want to comment out any On Error Resume Next statement so you

can get a better handle on any errors that may be occurring.

Sue Mosher

"Lori_CB" <LoriCB> wrote in message

news:A4D68340-3668-4417-909E-0FB0540BC86E@microsoft.com...

> I tried the Activate and PrintPreview methods. Each time, nothing
> happened
> when I clicked the Outlook Print button.
>
 
You are a goddess!

The ActiveWindow.Visible property and PrintPreview let me see the

information is on the form.

I added some message boxes so I know the form was filled out before the

PrintPreview statement and then after the PrintPreview statement.

When it hit the PrintOut statement, it cleared the form then did the actual

print.

Here's the code I used to test it.

' Print the Word document

msgbox "before preview"

oDoc.PrintPreview

msgbox "after preview"

oDoc.PrintOut

msgbox "after printout"

Now, I know it's the PrintOut statement that's causing the problem.

This has been driving me crazy for a week....thank you for saving my sanity.
 
Wow, that sounds quite odd, but at least you can print it manually once you

have it in preview. You might want to ask in a Word forum about why the form

fields are clearing.

Sue Mosher

"Lori_CB" <LoriCB> wrote in message

news:315C2FD7-1018-490B-A97A-998A00595E61@microsoft.com...

> You are a goddess!

> The ActiveWindow.Visible property and PrintPreview let me see the
> information is on the form.

> I added some message boxes so I know the form was filled out before the
> PrintPreview statement and then after the PrintPreview statement.

> When it hit the PrintOut statement, it cleared the form then did the
> actual
> print.

> Here's the code I used to test it.
> ' Print the Word document
> msgbox "before preview"
> oDoc.PrintPreview
> msgbox "after preview"
> oDoc.PrintOut
> msgbox "after printout"

> Now, I know it's the PrintOut statement that's causing the problem.

> This has been driving me crazy for a week....thank you for saving my
> sanity.
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
M Copy "To" Address Value from a Newly Created Email to the "To" Address Field of Custom Form Using Outlook 4
T Custom form created in 2003 won't print since upgrade to 2007 Outlook VBA and Custom Forms 1
J Outlook 2007 using custom form created for Outlook 2003 Outlook VBA and Custom Forms 2
boblewis Technical Issue with Custom Form - Save to Drafts Not Syncing Outlook VBA and Custom Forms 1
G Apply Custom Contacts form to all existing Contacts Outlook VBA and Custom Forms 1
G Add Map It button to Custom Contacts Form in Outlook Outlook VBA and Custom Forms 1
G Outlook 2021 Add Picture to Custom Contact Form Outlook VBA and Custom Forms 2
P Can't add custom field to custom Outlook form, it always adds to the Folder instead Outlook VBA and Custom Forms 2
AndyZ Contact Custom Form Tiny Text Outlook VBA and Custom Forms 3
A How to reduce size of custom contact form? Outlook VBA and Custom Forms 3
Witzker How to get the button Karte ( map) in custom contact form Outlook VBA and Custom Forms 2
B Outlook 2019 Custom Email form - Edit default email form Outlook VBA and Custom Forms 6
J Does the .fdm contain my custom form? How to make ol use it? - ol2007 Outlook VBA and Custom Forms 4
J ol2021 custom form not displaying pics Outlook VBA and Custom Forms 37
cbufacchi Outlook 365 Populate custom Outlook Appoint form Outlook VBA and Custom Forms 2
C Create Meeting With Custom Form Outlook VBA and Custom Forms 2
J custom form not displaying pictures Outlook VBA and Custom Forms 7
I Button PDF in Outlook Contact custom form Outlook VBA and Custom Forms 1
K Font Sizing in Custom Form Regions for Contacts Outlook VBA and Custom Forms 1
K can't get custom form to update multiple contacts using VBA Outlook VBA and Custom Forms 3
H Custom Outlook Contact Form VBA Outlook VBA and Custom Forms 1
F Validation on custom task form after task acceptance Outlook VBA and Custom Forms 1
I Error saving screenshots in a custom form in outlook 2016, outlook 365 - ok in outlook 2013, outlook 2010 Outlook VBA and Custom Forms 5
M VbScript for Command Button on Contacts Custom Form Using Outlook 1
G Other users can't see P.2 with custom fields in Form Outlook VBA and Custom Forms 0
O Create a custom contact form - questions before messing things up... Outlook VBA and Custom Forms 4
L Custom Form Tutoral? Outlook VBA and Custom Forms 6
D Lost Access to Custom Form Outlook VBA and Custom Forms 4
M vCard does not have user-defined fields from my custom contact form (365) Using Outlook 1
S Outlook Custom Form Scripting only working when clicking on "Run this form" Outlook VBA and Custom Forms 2
Victor_50 Outlook 2013 Custom Contact Form starts with "E-mail 2" Outlook VBA and Custom Forms 2
C Custom Form (seperate layout pages and message reading pane) Outlook VBA and Custom Forms 0
C Reading Pane for Custom Form Outlook VBA and Custom Forms 2
N Custom Form Controls Not Visible To Recipient Outlook VBA and Custom Forms 3
Randy Redekopp How To Merge Contact Info to Email Custom Form Template Using Outlook 2
D Problem with custom form including _DocSiteControl1 Outlook VBA and Custom Forms 0
C Custom Outlook Form - Populate Information from Radio Button / Check Box Using Outlook 0
W Message class changes of a custom form changes to the default form Using Outlook 2
A Possible to hide ribbon with custom appointment form? Outlook VBA and Custom Forms 3
S Custom Form, copy user field data to message body Outlook VBA and Custom Forms 12
Andrew Quirl Custom form to route requests based on input criteria Outlook VBA and Custom Forms 1
D Using a VBA Custom Form to Send Reoccurring Email Upon Task Completion Outlook VBA and Custom Forms 4
W Setting up a custom form Outlook VBA and Custom Forms 2
A Greyed out checkbox in custom form Outlook VBA and Custom Forms 4
Z Outlook Custom Form: Adding Dropdown(Project Code) at the end of subject Outlook VBA and Custom Forms 0
Z Adding dropdown list using custom form Outlook VBA and Custom Forms 7
J autocomplete function in custom form Using Outlook 1
D Custom form with html hyperlink Outlook VBA and Custom Forms 7
D populating listbox on custom form from Access Outlook VBA and Custom Forms 7
D Custom Form Accept and Reject Command buttons Outlook VBA and Custom Forms 2

Similar threads

Back
Top