Thread
:
Export Excel to Word
View Single Post
#
1
Posted to microsoft.public.excel.programming
dubscat
external usenet poster
Posts: 1
Export Excel to Word
stephen-
i am trying to develop a macro to accomplish a similar excel-to-word export function. the particular action i want is as follows, which we are simply doing by hand currently
we copy a portions of various excel sprdshts ("ss") and use the paste-special feature in word to paste in as an excel
worksheet object. we then format as required, etc.
my question is, then, would you be able to suggest a template macro to accomplish this, or could you suggest (an) alternative means to capture the excel data/object in word and the requisite template macro(s)? thanks
-----
wrote: ----
I am using Excel 97 and Word 97. I have the following routine which take
data from Excel and places it into a word template. It searches fo
Bookmarks and inserts the relevant data. I have one or two problems with i
and need some advice please
1. At the end of the routine Word stays open and the document is no
visible
2. The document name appears in the Word File menu and can be opened fro
here
3. When the document is opened it does not appear in print layout view, bu
has a head/footer window open even though the last data inserted into th
document was placed in the body text of the document. The routine exportin
data from Excel does place some information in the header/footer agains
given bookmarks
Sub ExportToWord(
Dim WordBasic As Word.documen
Dim WordFile As Strin
Dim CurrentDir As Strin
Dim FileToSave As Strin
On Error Resume Nex
CurrentDir = Application.ActiveWorkbook.Pat
FileToSave = Application.GetSaveAsFilename("Document 1 ", filefilter:="Wor
Document (*.doc), *.doc"
If FileToSave = "" The
Exit Su
End I
' path and name of RT.do
WordFile = Sheets("settings").Cells(20, 2).Valu
Set WordBasic = GetObject(WordFile
WordBasic.Application.Visible = Fals
With WordBasi
'ROUTINE STARTS HERE FOR PASTING DAT
If .Bookmarks.Exists("Name") = True The
.Bookmarks("Name").Selec
.ActiveWindow.Selection.text = frmSearch.txtNam
End I
'< - Routine searching for bookmarks and inserting data here -
End Wit
WordBasic.SaveAs (FileToSave
Application.StatusBar = Fals
WordBasic.Application.Visible = Tru
Set WordBasic = Nothin
End Su
Reply With Quote
dubscat
View Public Profile
Find all posts by dubscat