Thread: [Solved] Run a Macro in Word 2010
View Single Post
 
Old 04-29-2011, 07:09 AM
Joyce301 Joyce301 is offline Windows 7 64bit Office 2010 32bit
Novice
 
Join Date: Apr 2011
Posts: 2
Joyce301 is on a distinguished road
Default

Thank you so much! The print macro runs perfect. I have another macro that I use to format each document before I send them to the printer. If I attempt to print without formatting, it prints perfectly. If I format the document first, it prints everything and then goes back and prints the active document a second time. Here is my macro for formatting, do you see what I could be doing wrong?

Code:
Sub FormatTheFile()
If ActiveWindow.View.SplitSpecial <> wdPaneNone Then
  ActiveWindow.Panes(2).Close
End If
If ActiveWindow.ActivePane.View.Type = wdNormalView Or ActiveWindow.ActivePane.View.Type = wdOutlineView Or ActiveWindow.ActivePane.View.Type = wdMasterView Then
  ActiveWindow.ActivePane.View.Type = wdPageView
End If
 
FileName$ = GetFileType$()
Select Case FileName$
  Case "IPWSM": Call SecondLogo
  Case "IPWSP": Call SecondLogo
  Case "IOPWSM": Call SecondLogo
End Select
 
ChangeFileOpenDirectory "\\Lion\D$\CLIENTS\Authorization\"
Documents.Open FileName:="LogoFile.doc", ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="", Format:=wdOpenFormatAuto
ActiveDocument.Shapes("Picture 6").Select
Selection.Copy
ActiveDocument.Close SaveChanges:=False
 
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.Paste
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
ActiveWindow.ActivePane.View.Zoom.Percentage = 25
 
FileName$ = GetFileType$()
Select Case FileName$
  Case "OICPIA": Call OICPIA
  Case "OICPOA": Call OICPOA
  Case "IPSDP", "OPINTM", "IOPWSM", "IPHWP", "IOPWSPM", "IOPHEM", "IOPHEPM", "IOPHWPM", "IOPHWM"
    Selection.EndKey Unit:=wdStory
  Case Else
  'TEMP$ = MsgBox(FileName$ + ": UNKNOWN TYPE.", vbOKOnly, "Error")
End Select
End Sub
 
Sub SecondLogo()
ChangeFileOpenDirectory "\\Lion\D$\CLIENTS\Authorization\"
Documents.Open FileName:="LogoFile.doc", ConfirmConversions:=False, ReadOnly:=False, AddToRecentFiles:=False, PasswordDocument:="", PasswordTemplate:="", Revert:=False, WritePasswordDocument:="", WritePasswordTemplate:="", Format:=wdOpenFormatAuto
ActiveDocument.Shapes("Picture 5").Select
Selection.Copy
ActiveDocument.Close SaveChanges:=False
 
ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageHeader
Selection.Paste
ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument
End Sub

Last edited by macropod; 04-29-2011 at 06:39 PM. Reason: Added code tags
Reply With Quote