VBA: Get listbox item into Word Document

Xlacs

Board Regular
Joined
Mar 31, 2021
Messages
105
Office Version
  1. 2016
Platform
  1. Windows
Hello Everyone,

I managed to get the textbox values in to the word document using smozgur method.

  1. Select #Date# range on the Word document.
  2. Click Insert tab on Ribbon and click Bookmark.
  3. Enter the bookmark name, "datefield" (or whatever you like).
  4. Click Add, then the Bookmark dialog is closed.

VBA Code:
WordDoc.Bookmarks("datefield").Range.Text = Me("Textbox").Value

However, in my userform, I have a listbox with 3 col and 6 row.
So I inserted a table in my word and apply the same method.

When I used the above codes, only the first text of first column is showing. Any idea why?

VBA Code:
 WordDoc.Bookmarks("Target").Range.Text = Me("Listbox1").Value

Thank you in Advance!
 

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

Forum statistics

Threads
1,214,590
Messages
6,120,423
Members
448,961
Latest member
nzskater

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