Acess a Word-Dropdown List from Excel VBA

Devagorgon

New Member
Joined
Sep 25, 2018
Messages
13
Hello,

I am sitting on an Excel VBA-script, that opens a Word Document and fills out some Cells in a Table located in the Word Header with values it reads from an Excel File.
So Far it works using code like

Dim oConvWB As Workbook

Set oConvWB = Workbooks.Open(TextBox_ExcelPath.Text)

Dim AppWord As Object

Set AppWord = CreateObject("Word.Application")

Dim AppWdDoc As Object

Set AppWdDoc = AppWord.Documents.Open(TextBox_WordPath.Text)

oConvWB.Sheets("Header").Select

Dim CellText As String

CellText = oConvWB.Sheets("Header").Range(Cells(2, 2), Cells(2, 2)).Text

AppWdDoc.Sections(1).Headers(1).Range.Tables(1).Cell(1, 3).Range.InsertAfter CellText


The problem is, Cell(3.2) in the Word document header contains a Dropdown-List-Element, which I have to set accordingly, but I don't know how to access it.

Can someone tell me the right way to acces the list and set the element?


Furthermore, in addition to searching the web, i have tried to display the local window in VBA and look at the Properties of AppWdDoc myself, but I cannot comprehend, what I am seeing. Could someone give me a quick intro on how to find special objects like fields, tables, dropdown list, etc in header and body and their respective names? (Then maybe I can find out myself next time)

Thanks
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,223,744
Messages
6,174,253
Members
452,553
Latest member
red83

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top