Word Addin for FileOpen Dialog

R

Ram Prakash Singh

Hi,
When we click on File | Open in Word, we get a file open
dialog. Then we select a file in the FileOpen dialog and
click on Open button.

I want a hook (add-in) which works after the file is
selected and open button is clicked. I want to know the
which file has been selected for opening, check some
properties and proceed based on the properties.

I tried doing this by overriding DocumentOpen function.
But this function is getting called after the file has
been opened in word. I want to catch even before the file
is opened in word.

Any help in this regard will be highly appreciated.

Thanks and Regards,
RPSingh
 
N

Nicolas

Hello Ra

Dim oDlg As Word.Dialog, vRet As Intege

Set oDlg = Dialogs(wdDialogFileOpen
vRet = oDlg.Displa
'vRet = 0 : Cance
'vRet = -1 : O
if Vret = -
MsgBox oDlg.Nam
elseif vRet =
MsgBox "Cancelled
end i

See Word documentation for more details (Dialogs)
 
G

Guest

Hi,
Thanks for the response. But the code that you have
suggested is in VBA.

I want it to be done in COM Addin or
How do I run the COM Addin code after the VBA code or
or How do I give the input from VBA to COM Addin

RPSingh
 
N

Nicolas

I'm not to sure to see the point. Dialogs objects are callable from VB in a COMAddin. You just need to set a reference to Wordxx and Officexx in the COMAddin project in order to access these objects as all Word/Office Object model.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top