Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 02-14-2013, 03:10 PM
kar64 kar64 is offline vba word 2003: printout prints only the first page of the file Windows 7 64bit vba word 2003: printout prints only the first page of the file Office 2003
Novice
vba word 2003: printout prints only the first page of the file
 
Join Date: Feb 2013
Posts: 2
kar64 is on a distinguished road
Default vba word 2003: printout prints only the first page of the file

Hi all.
I'm Italian. Sorry for my bad English.
First: I do not know to program in vba word and write what I derived from the macro recorder and the Internet.

In my code I open a doc file, edit the footer and print the document.
I do it with this code:



Code:
nomefiletab = (Trim(Testo99.Value & "")) + "\" + Right("000" + Trim(CasellaCombinata34 & ""), 3) + "_test.DOC" 
If FileEsiste3(nomefiletab) Then 
    For nco = 1 To Val(tabst2co) 
        piepag = "" 
        piepag = "TEST - Allegato " & trim(str(nco)) 
            Set objWord = New Word.Application 
            Set wDoc = objWord.Documents.Open(nomefiletab) 

            ' cancella il pie' di pagina vecchio 
            objWord.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter 
            objWord.Selection.ParagraphFormat.Alignment = wdAlignParagraphRight 
            objWord.Selection.Delete Unit:=wdCharacter, Count:=1 
            objWord.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter 
            objWord.Selection.EndKey Unit:=wdLine, Extend:=wdExtend 
            objWord.Selection.Delete Unit:=wdCharacter, Count:=1 
            objWord.ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument 
     
            ' aggiunge il pie' di pagina nuovo 
            objWord.ActiveWindow.ActivePane.View.SeekView = wdSeekCurrentPageFooter 
            objWord.Selection.ParagraphFormat.Alignment = wdAlignParagraphRight 
            objWord.Selection.Font.Name = "Courier New" 
            objWord.Selection.Font.Size = 7 
            objWord.Selection.Font.Bold = True 
            objWord.Selection.TypeText Text:=piepag 
            objWord.ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument 
    
'            objWord.ActiveDocument.ActiveWindow.Activate 
            objWord.Application.WindowState = wdWindowStateMinimize 
            wDoc.Activate 
  
            objWord.Visible = True 
            
            'objWord.ActiveDocument.PrintPreview 
         
            ' stampa il documento 
            wDoc.PrintOut 
   
            wDoc.Close 
            objWord.Quit SaveChanges:=wdDoNotSaveChanges 
             
            Set objWord = Nothing 
            Set wDoc = Nothing 
             
    Next nco 
    S2OK.Visible = True 
     
endif
Well if I go to print preview ('objWord.ActiveDocument.PrintPreview) everything works, if I use printout print the first page of the document!

I do not know how to solve.

Someone can 'help me?

thanks
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
vba word 2003: printout prints only the first page of the file embed autocad drawing in word document prints very light gbehm@broan.com Drawing and Graphics 1 03-15-2011 08:05 PM
Extaneous Unwanted file information prints junehorner Word 2 01-23-2011 12:27 PM
Printout problem with customized bullets eroock PowerPoint 2 12-27-2009 02:11 PM
word only prints pictures AidyTy Word 0 12-15-2009 01:50 PM
Footer so low on page only top half prints Renee Hendershott Word 1 01-22-2006 05:09 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:06 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft