473,750 Members | 2,190 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 8396
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
2979
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
6156
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
8836
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
9575
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
8260
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
6803
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
6080
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4712
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4885
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2798
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2223
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.