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 populate word from excel: On clickin "Export" button in excel

Hi All, I want to populate a word template with data frome excel. I have
designed an "Export" button in excel sheet, which on clicking should populate
certain fields in a word file. Here is my code so far, But its not working!!
Any help would be highly appretiated.

Private Sub Export_Click()

Dim objWord As New Word.Application
Dim doc As Word.Document
Dim bkmk As Word.Bookmark
sWdFileName = Application.GetOpenFilename(, , , , False)

Set doc = objWord.Documents.Open(sWdFileName)

strTemplateName = "TestTemplate.dot"

strPathTemplateName = "C:\My Documents" & strTemplateName
Set objWord = CreateObject("Word.Application")


With objWord

.ActiveDocument.variables("Address").Value = Range("Address").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
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
I need my export to include the "file as" category in Excel ChapmanManagement Excel Discussion (Misc queries) 1 May 15th 08 10:51 PM
Export to excel via webpage: "Invalid Procedure Call or Argument" Bruno Excel Programming 0 March 19th 08 11:55 AM
How do export Excel file to .txt delimited by "^"? JuliaMK Excel Discussion (Misc queries) 3 January 9th 07 05:39 PM
Folder Graphic (in Word & Pub) instead of "Close" button in Excel Susan ARC Excel Discussion (Misc queries) 1 September 3rd 06 04:34 AM


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

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

About Us

"It's about Microsoft Excel"