ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   FileDialog Box Question (https://www.excelbanter.com/excel-programming/360834-filedialog-box-question.html)

Paul

FileDialog Box Question
 
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






All times are GMT +1. The time now is 12:11 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com