FileDialog Box Question

P

Paul

Hello and good morning, I am trying to use a filedialog object to get a path
from a custom DLL. The code in the DLL is the following:

--- Code Snippet ---
Function GetNumb() As String
Set FP = Application.FileDialog(msoFileDialogFolderPicker)
With FP
.Title = "Folder Picker"
End With
If FP.Show <> 0 Then
GetNumb = StrConv(FP.SelectedItems.Item(1) & "\", vbFromUnicode)
Else
MsgBox "user hit Cancel"
End If
End Function

---Code Snippet ---

My question/behavour is this. When I choose the Save/Cancel Buttons. The
code starts a new Excel object (I think it is an object because in my taskbar
I have another Excel window. If I try and maximize it it just is a blank
workbook. The Excel works code works but this blank workbook is there. Here
is how I am calling the function. It seems that the code executing when
selecting the Open/Cancel buttons does not have the focus.
One of the things I was going to try was to minmize Excel afer executing the
code when the Open/Cancel button. but the problem with the additional
workbook still has me baffled.
Any suggestions please let me know.
BTW: This code works perfectly outside the DLL.
Thanks for any input.

--- Code Snippet ---
Private Declare Function GetNumb Lib "g:\paul\stringsPart2\string2dll.dll"
() As String

Private Sub CHKNet()
Dim Default_DIR As String
Default_DIR = GetNumb
MsgBox Default_DIR
End Sub
 

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