Code that maximises Word for opening in Vista

Yes, haven't I read somewhere that 2007 comes with variable formatting, whether or not it works as it says on the box of course is a different matter;)

I think I have read similar to what you have read. A huge leap in faith is required to believe what is on the box:D
 
But.........



If you "maximise" it by dragging the edges of the Word doc window to the edges of your screen, it should open in that size every time!
I thought everyone knew this. You can do it, yes, but it pretty much defeats the purpose of what Mike is trying to do for someone here (that be, automate it without any manual intervention. Nice try though... :)


and Mike....so the Word Application opens minimized, but you can still see the app. window on the bottom of the screen in the taskbar???
 
Adam,

You see the button on the taskbar with the name of the Word.doc and that has been on three different computers with Vista.

Same code on XP and opens as maximised.

I can get around it with batch files since the letters that need to "display" are just that, simply opened. All the other letters where data goes to bookmarks are printed and closed in one go.

But I have two problems with batch files. I want to minimise the number of files I have to give someone that are not "actions" from within the data base itself. The other problem is that with batch files I can't get the cursor to position a couple of spaces under the bookmark, that is, the position where typing starts.

Batch files sure are simple. \Letters\CommFees.doc
 
Mike,

To solve the window problem, maybe you can take the easy way out and issue an auto macro in the underlying template? I assume every letter that is opened has been created from a template of somekind? Open the template, and create a new module in it, then write the short procedure for maximising the window under "this document":
Code:
Private Sub Document_open()

  Application.WindowState = wdWindowStateMaximize

End Sub
If you didn't use a template to write the letters, just open Word, and write the above code with the NORMAL.DOT template that is automatically loaded.

Also, if you need to extract the user of the machine, use:
Code:
Application.UserName
 
Adam,

Would this MS article cover what you are saying.

http://support.microsoft.com/kb/286310

I have not made macros/modules in Word before.

I would prefer not to anything to the Normal.dot file on others computer. I have the letters stored as OLE embedded and my DB creates a folder \letters if it does not exist and then stick the letters into the folder.

I use the following code with a bunch of them in a module and run from a macro with GoToNextRecord etc. As a side note the OLE opens maximised as it goes through each record.

If (Forms!FormLetters!ABC Like "ENotes") Then

Forms![FormLetters]!MyOle.Verb = -2
Forms![FormLetters]!MyOle.Action = 7
Set Word_Obj = Forms![FormLetters]!MyOle.Object.Application.WordBasic


Word_Obj.FileSaveAs ("c:\Letters\0ENotesMike.doc")

End If
 
Adam,

I just made an AutoOpen macro with

Application.WindowState = wdWindowStateMaximize

but that did not work. I made it for specific Word.doc not Normal.dot
 
you have to do it differently when you create it in the document. Let me see what happens on my end here. I have to change my default programs first. I have 2007 set up as the default for WINWORD documents...
 
Sample

Mike,

Attached is a sample of the code that works here. The document called "Payroll Business" was opened from a 2003 database by the click of a button. It is a free-standing file on my desktop. The window was opened in the taskbar, and then maximised from a half-window look as it was when it was open (i saved it that way on purpose with the previous close of the file to test it). Anyway, it works fine the above specs. See if you can copy what I did.

Note that the window was not brought to front when it was opened...it was just maximised in the background, with the application showing that it was running by the taskbar document window...
 

Attachments

  • sample.jpg
    sample.jpg
    86.5 KB · Views: 199

Users who are viewing this thread

Back
Top Bottom