ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to get a return value from a user defined function (https://www.excelbanter.com/excel-programming/332833-how-get-return-value-user-defined-function.html)

Glen Mettler[_4_]

How to get a return value from a user defined function
 
Using Excel 2002
I am using the FileDialog sub provided in the help to open a file.
I want to call that from another sub and return the selected filename.
I change FileDialog from a sub to a function but I can't get it to return
the name of the selected file.
Here is what I want to do:

MySub()
MyPik = FileDialog("")
If MyPik = "" then
exit sub
end if
If MyPik < xxx then
exit sub
else
openfile
endif

I can't get the FileDialog function to return the file name

Glen



Damon Longworth

How to get a return value from a user defined function
 
Have a look at GetOpenFilename Method in help.

--
Damon Longworth

Don't miss out on the 2005 Excel User Conference
Sept 16th and 17th
Stockyards Hotel - Ft. Worth, Texas
www.ExcelUserConference.com


"Glen Mettler" wrote in message
...
Using Excel 2002
I am using the FileDialog sub provided in the help to open a file.
I want to call that from another sub and return the selected filename.
I change FileDialog from a sub to a function but I can't get it to return
the name of the selected file.
Here is what I want to do:

MySub()
MyPik = FileDialog("")
If MyPik = "" then
exit sub
end if
If MyPik < xxx then
exit sub
else
openfile
endif

I can't get the FileDialog function to return the file name

Glen






All times are GMT +1. The time now is 04:41 AM.

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