ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   reference for OpenFileDialog (https://www.excelbanter.com/excel-programming/405441-reference-openfiledialog.html)

MattE

reference for OpenFileDialog
 
From within my excel VBA code I need to open another spreadsheet so am
using OpenFileDialog (unless there is there a better way?) but can't
get it to be recognized. What reference do I need to add for the file
dialogs?

FSt1

reference for OpenFileDialog
 
hi
using your method, you can select the file and click the open button. but if
that is too much of a hassel, then you would need to hard code the open file
into your code ie
Workbooks.Open Filename:="C:\your\file\path\thafile.xls"

regards
FSt1

"MattE" wrote:

From within my excel VBA code I need to open another spreadsheet so am
using OpenFileDialog (unless there is there a better way?) but can't
get it to be recognized. What reference do I need to add for the file
dialogs?


Nigel[_2_]

reference for OpenFileDialog
 
Use the following in which myFileOpen is True if a valid file was selected
and opened, else False.

Dim myFileOpen as Boolean
myFileOpen = Application.Dialogs(xlDialogOpen).Show


--

Regards,
Nigel




"MattE" wrote in message
...
From within my excel VBA code I need to open another spreadsheet so am
using OpenFileDialog (unless there is there a better way?) but can't
get it to be recognized. What reference do I need to add for the file
dialogs?




All times are GMT +1. The time now is 05:40 PM.

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