LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sam Sam is offline
external usenet poster
 
Posts: 699
Default export certain cells from excel to word

Hi All, I am trying to export certain detail from excel to word on a click of
a button from excel, Here is my code. I know I am missing something, Can you
please guide my way thought this.

Private Sub Export_Click()

Dim objWord As Object 'Word Object
Dim strTemplateName As String 'Template name
Dim strPathTemplateName As String 'Path & Template
Dim sWdFileName As String

Set doc = objWord.Documents.Open(sWdFileName)

strTemplateName = "TestTemplate.dot"

strPathTemplateName = "C:\My Documents" & strTemplateName

Set objWord = CreateObject("Word.Application")

With objWord

.ActiveDocument.bookmarks("Address").Range = Sheet2.Range("B4").Value
.ActiveDocument.bookmarks("City").Range = Sheet2.Range("B5").Value
.ActiveDocument.bookmarks("State").Range = Sheet2.Range("B6").Value
.ActiveDocument.bookmarks("Zip").Range = Sheet2.Range("B7").Value

End With
objWord.Visible = True

Set objDoc = Nothing
Set objWord = Nothing
End Sub

Thanks in Advance
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Export % from Excel to Word as % Philippe Perrault Excel Programming 1 December 27th 08 01:28 AM
Export from Excel to Word Kaz G Charts and Charting in Excel 0 March 28th 07 02:52 PM
Export from Excel to Word kath0178 New Users to Excel 2 September 13th 06 05:30 PM
export/copy excel cells to Word Salim Excel Discussion (Misc queries) 1 April 23rd 06 08:09 AM
export from excel to word Curious[_4_] Excel Programming 1 June 4th 04 10:56 PM


All times are GMT +1. The time now is 04:06 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"