473,737 Members | 6,642 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Open file with File Dialog

I know how to use the File Dialog control but I'm not sure how to
actually open the file that is selected. Here's my code:

'Create a FileDialog object as a File Picker dialog box.
Set fd = Application.Fil eDialog(msoFile DialogOpen)

'msoFileDialogF ilePicker

' Select Excel file for import
With fd
If .Show = True Then
.AllowMultiSele ct = False

'Find the selected file name
For Each varFile In .SelectedItems
strFile = varFile
Next
Else
MsgBox "Select a file."
GoTo FindFile_Exit
End If
End With

So once I have the name of the file what do I need to do? Thanks in
advance for the help.

Oct 22 '07 #1
3 8395
Ecohouse wrote:
I know how to use the File Dialog control but I'm not sure how to
actually open the file that is selected. Here's my code:

'Create a FileDialog object as a File Picker dialog box.
Set fd = Application.Fil eDialog(msoFile DialogOpen)

'msoFileDialogF ilePicker

' Select Excel file for import
With fd
If .Show = True Then
.AllowMultiSele ct = False

'Find the selected file name
For Each varFile In .SelectedItems
strFile = varFile
Next
Else
MsgBox "Select a file."
GoTo FindFile_Exit
End If
End With

So once I have the name of the file what do I need to do? Thanks in
advance for the help.
This should get you started
http://www.mvps.org/access/api/api0018.htm
Oct 22 '07 #2
On Oct 22, 4:29 pm, Ecohouse <ecovinda...@ya hoo.comwrote:
I know how to use the File Dialog control but I'm not sure how to
actually open the file that is selected. Here's my code:

'Create a FileDialog object as a File Picker dialog box.
Set fd = Application.Fil eDialog(msoFile DialogOpen)

'msoFileDialogF ilePicker

' Select Excel file for import
With fd
If .Show = True Then
.AllowMultiSele ct = False
I don't API that's why I was using the File Dialog. Do you know what
I need to do to get this working?
>
'Find the selected file name
For Each varFile In .SelectedItems
strFile = varFile
Next
Else
MsgBox "Select a file."
GoTo FindFile_Exit
End If
End With

So once I have the name of the file what do I need to do? Thanks in
advance for the help.

Oct 23 '07 #3
Ecohouse wrote:
On Oct 22, 4:29 pm, Ecohouse <ecovinda...@ya hoo.comwrote:
>>I know how to use the File Dialog control but I'm not sure how to
actually open the file that is selected. Here's my code:

'Create a FileDialog object as a File Picker dialog box.
Set fd = Application.Fil eDialog(msoFile DialogOpen)

'msoFileDialo gFilePicker

' Select Excel file for import
With fd
If .Show = True Then
.AllowMultiSele ct = False

I don't API that's why I was using the File Dialog. Do you know what
I need to do to get this working?

> 'Find the selected file name
For Each varFile In .SelectedItems
strFile = varFile
Next
Else
MsgBox "Select a file."
GoTo FindFile_Exit
End If
End With

So once I have the name of the file what do I need to do? Thanks in
advance for the help.


File/Open (selects file)
http://www.mvps.org/access/api/api0001.htm
EX:
'creates a series of file filters
strFilter = ahtAddFilterIte m(strFilter, _
"Microsoft Access Files (*.mdb)", "*.mdb")
strFilter = ahtAddFilterIte m("", "Excel Files (*.xls)", "*.xls")
strFilter = ahtAddFilterIte m(strFilter, _
"All Files (*.*)", "*.*")
'now get a filename
strFile = GetOpenFile(str Filter:=strFilt er)

Run/open file with associated exe
http://www.mvps.org/access/api/api0018.htm
Ex:
If strFile "" THen_
var = fHandleFile(str File, 3) '3 opens maximized
Oct 23 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
16223
by: Martin | last post by:
Again drawing on the groups experience:- 1. For general file opening and file saving, using VB6, are there any issues with using the FileOpen and FileSave Common Dialog Boxes? 2. Is using the FileOpen and FileSave Common Dialog Boxes the best way to go in general? 3. For Most of my projects I will be using the same types of data input form and report output form, as discussed here recently. Also, the files that are
4
5106
by: John | last post by:
Hi, I generate a report in a comma delimited file and give it a name like MyReport.csv . I then set a Hyperlink control to point tp the file HyperLink1.text = "Download" Hyperlink1.NavigateUrl = "MyReport.csv" When the user clicks the HyperLink I would always like to
2
3197
by: Jonathan Trevor | last post by:
Hi, For the last couple of releases of a product we're developing we've been running to very wierd behavior from IE and our ASP.NET web application which serves up various types of files and I'm getting very frustrated in trying to solve it! We content we are serving up is potentially sensitive and therefore we DO NOT want it cached on the remote client (IE) beyond the lifetime of the application rendering it (IE, Powerpoint, Word...
0
2978
by: Dune | last post by:
Hi there, I have an aspx page that allows users to enter several parameters using drop downs and text boxes. The users then press a button that produces an extract based on the parameters they entered. When this button is pressed and extract is prduced and IE's standard Open/Save dialog should popup so they can navigate to the directory to save the extract in, or if they want, they can choose to open and view the extract without saving it. ...
4
3686
by: Dorte | last post by:
Hi, I am using the code below to stream a CSV file with the response object. Dim FileName As String = "Test.csv" With Web.HttpContext.Current.Response Web.HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=" & FileName) .Charset = ""
2
6155
by: Mattbooty | last post by:
Hello, Not sure if anyone else has seen this bug, but I have a form where the entire form is covered with a picturebox. The picturebox has a mouseup event. I also have an open file dialog for loading images into the picturebox. If you double click the file you want to open in the open file dialog, it somehow interperets one of the clicks as a mouseup on the picturebox and fires the mouseup event for the picturebox. How can I get...
5
5406
by: charles | last post by:
I have a question about the file Open dialog box. I would like to be able to make the dialog box bigger by selecting the bottom right-hand corner and dragging/expanding the box. I am told by my colleagues that this is not "standard" but find it hard to believe. Opening a file in MS word for example, the dialog has
7
4015
by: Peter | last post by:
ASP.NET 2.0 I am trying to open a Word document and Excel document from a dialog web page, what's the best way to do that? I have tried the following: Response.Clear(); Response.AddHeader("Content-Disposition", "attachment; filename=" + file.Name);
5
6208
by: Stefano Tonello | last post by:
Hi all, I need to call windows' "open with" dialog from my C# windows form application. After the user selects application, control must return to me (I have to launch directly the process). I found this solution: http://www.codeproject.com/KB/shell/openwith.aspx but it's not good for me since it will execute the process directly.
14
4279
by: strat18 | last post by:
My database code works on my server and one laptop, but does not function correctly on two other laptops, all four systems run Vista Business and MSaccess 2007. The code is set up to display the file path in the open dialog file name box, that way the user clicks a button on a form, the open dialog box pops up, and the user just hits enter to open the file (the only reason the dialog box pops up is if the user wants to open a different file)...
0
8786
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9470
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9334
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9258
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8207
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6749
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4823
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2744
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.