This project has moved. For the latest updates, please go here.

Open File Dialog Boxes - Word - VB

Feb 17, 2013 at 10:27 PM
Hi

I have a custom task pane and want to link the button on the custom task pane to the open file dialog box, I then want the ability for the user to select image files. In the custom pane I want to list the file names using lables (creating a new label for each file name).

I understand how to code the custom pane properties however I do not know how to use open file dialog boxes in VB (I did in VBA).

Note I am using developer toolbox with visual studio express 2010 and 2012. Also this is the first time I am adding code in visual studio express.

If you require me to explain anything further, let me know. Any help on this matter would be much appreciated. Thanks
Coordinator
Feb 18, 2013 at 2:33 PM
Edited Feb 18, 2013 at 2:33 PM
Feb 19, 2013 at 3:26 AM
Sebastian thanks for that.

I thought I might test out using the Me keyword and VBA ie Me._application.FileDialog etc etc to generate the open file dialog box. I am more familiar with VBA then Visual basic. Any comments?

Can you programmingly add controls (ie a listbox) to a custom task pane (ie a usercontrol)?

Thanks again
Coordinator
Feb 19, 2013 at 4:37 AM
you want the open file dialog from the office application?

use Controls collection to add a control at runtime.
something like this:

Dim myUserControl As UserControl1 = new UserControl1()
myUserControl.Visible = True
myUserControl.Location = new Point(0,0)
myUserControl.Size = new Size(200,200)
taskPaneControl.Controls.Add(myUserControl)
Feb 19, 2013 at 5:09 AM
Yes the aim is to create a Word Add-in, so coming from a VBA background I was wanting to code as much as I could in VB using the Me keyword.

Clearly I have to do more research, can you clarify, the usercontrol is a list box, combo box etc not a custom task pane. I have to create a new form right to create a custom task pane. I was wanting to add a listbox to a custom task pane (similar to the form used as the navigation pane in word 2010).

If the above sounds confusing it is because my understanding is still at a basic level.

Thanks again for your help