Question Export Visual Studio Data to Word Template

brannon6863

New member
Joined
Apr 3, 2014
Messages
1
Programming Experience
Beginner
Hello I am fairly new to programing with Word documents using Visual Studio so forgive me if this is the wrong forum. I have a VS user form with comb boxes after the user selects the information they hit the save button
and it exports the data to Excel this works perfectly but now I want to take that data and also save it to a Word template I have and I need help any help would be appreciated. Below is my code for the excel portion.

Dim xlApp = GetObject("", "Excel.Application")
Dim xlBook = xlApp.Workbooks.Open("\\storage\pmaintenance\Doug's File\Lewis Creek Test\Lewis Creek Task Test3.xlsx")
Dim xlSheet = xlBook.Worksheets("Sheet1")

'set visibility
xlApp.Visible = False

' Display the range's rows and columns.
row_min = xlSheet.UsedRange.Row
row_max = row_min + xlSheet.UsedRange.Rows.Count - 1
col_min = xlSheet.UsedRange.Column
col_max = col_min + xlSheet.UsedRange.Columns.Count - 1


'enter data
xlSheet.cells(row_max + 1, col_min).Value = ComboBox1.Text

xlSheet.cells(row_max + 1, col_min + 1).Value = ComboBox2.Text

xlSheet.cells(row_max + 1, col_min + 2).Value = ComboBox3.Text
 
Back
Top