473,382 Members | 1,329 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

automation Template word by VB.net

hello all,

I want to create an application in vb.net and I would pre-fill some part of a word template (date, name, tables, pictures) through my application.
I used the following code:
Imports Word = Microsoft.Office.Interop.Word
Public Class Form1

Expand|Select|Wrap|Line Numbers
  1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 
  2. Dim wdApp As Word.Application = New Word.Application() 
  3. wdApp.Visible = True 
  4.  
  5. 'L'adresse entre griffes est celle du fichier .dotx qui sera modifié 
  6. Dim wdDoc As Word.Document = wdApp.Documents.Add("F:\Hippolyte\Desktop\Hippolyte\Desktop\NewFolder\baseTemplate2.dotx") 
  7.  
  8. 'Text1 est le nom du signet qui sera remplacé dans le fichier .dotx . 
  9. wdDoc.Bookmarks("Text1").Range.Text = nameTextBox.Text 
  10.  
  11. wdDoc = Nothing 
  12. wdApp = Nothing 
  13. GC.Collect() 
  14. GC.WaitForPendingFinalizers() 
  15. GC.Collect() 
  16. GC.WaitForPendingFinalizers() 
  17. End Sub 
  18.  
  19. End Class 
I have too problemes: the first, Im using chekedlistbox to insert names in a word template, im' using the following code but it only inserts the last ITEM on the list. I want to write each word is in a line with puces like:
-asmae bethaoui
-mariam nejjar
-...
the second problem: I don't know the code that will allow me to fill tables and insert pictures in my word template.
My thanks in advance
Mar 22 '13 #1
0 1009

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: raesunshin | last post by:
I just opened my spiffy new VB.NET 2003 and tried to run my programs that worked fine in earlier VB.Net versions. They use the statement IMPORTS WORD at the top of the program or IMPORTS EXCEL,...
0
by: R1gg4 | last post by:
Hi all, I currently have a VB.NET application that interfaces with Word 2003 to produce documents from templates substituting the data in the template to form the document. This is all working...
22
by: liya.tansky | last post by:
Hello, I'm developing an intranet (win XP, .NET 2, Visual Studio 2005, Microsoft.Office.Interop.Word.dll in references) and needed to implement find-replace in word doc before sending letter and...
1
by: amit | last post by:
Hey guys I am trying to develop an application which would open an word file (.doc) and split it into multiple files. I want to create seperate file for tables, so the application should just...
4
by: Bob Darlington | last post by:
I'm using the following code to check whether Word is running: Function IsAppRunning(strAppname As String) As Boolean Dim strClassName As String Select Case LCase$(strAppname) Case "Excel": ...
10
by: cj2 | last post by:
I open a word template in VB and add values to the bookmarks then save the document as as pdf. When I then go to close the document it pops up a save as dialog box. It's already saved the...
1
by: vdosev | last post by:
I have MS Access Database clients database. When client places an order – I have developed VBA code to create an email confirming the details of the order. Everything is coded, but the body text...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.