» »

Word Visual Basic -shranjevanje posamicne strani

Word Visual Basic -shranjevanje posamicne strani

smeskec001 ::

Pozdravljeni.
Imam wordov dokument 100 strani. Vsaka stran je bila generirana avtomaticno. Ker so dokumenti razlicni bi moral sedaj vsako stran shraniti posebaj ker to vzame veliko casa me zanima ce ima program ( visual basic) ki bi pogleda v excel tabelo in vsaki strani dodelil svojo ime in jo shrani.
HVALA!

smeskec001 ::

Evo nasel sem VBA kodo sedaj, se mi manjka samo kako linkat z excel tabelo. Vrstica

Generate the file name
fn = "Page" + CStr(idx) + ".doc"





Sub SavePagesAsDoc()

Dim orig As Document
Dim page As Document
Dim numPages As Integer
Dim idx As Integer
Dim fn As String


' Keep a reference to the current document.
Set orig = ActiveDocument

' Calculate the number of pages
numPages = ActiveDocument.Range.Information(wdActiveEndPageNumber)

For idx = 1 To numPages
' Make sure the document is active
orig.Activate

' Go to the page with index idx
Selection.GoTo What:=wdGoToPage, Name:=idx

' Select the current page
Selection.GoTo What:=wdGoToBookmark, Name:="\page"

' Copy the selection
Selection.Copy

' Create a new document
Set page = Documents.Add

' Activate it
page.Activate

' Paste the selection
Selection.Paste

' Generate the file name
fn = "Page" + CStr(idx) + ".doc"

' Save the document as Word 97-2003
page.SaveAs FileName:=fn, FileFormat:=wdFormatDocument, AddToRecentFiles:=False

' Close the document
page.Close

Next

End Sub


Vredno ogleda ...

TemaSporočilaOglediZadnje sporočilo
TemaSporočilaOglediZadnje sporočilo
»

VB.net Excel v Tif

Oddelek: Programiranje
121144 (1043) saule
»

Word 2003 VBA problem

Oddelek: Programska oprema
101036 (923) mimax
»

VISUAL BASIC - Makro v wordu - prenos podatkov iz tabel v excel

Oddelek: Programiranje
52883 (2745) FlashM
»

access -> word ali excel

Oddelek: Programska oprema
51222 (1163) zavajon
»

[excel]duplikati

Oddelek: Programiranje
81472 (1399) baksuz

Več podobnih tem