I would like to open a folder from command button and I am not having any luck; - ...
-
Dim stdfile as string
-
open stdfile "c:\temp"
-
End sub
and I am getting error because I have nothing after open, as far as I know my code can be all wrong.
Thanks for helping Trevor2007
7 22633
What do you mean: Open?
Are you wanting an Open File dialog box, a Windows Explorer window with the Folder displayed?
Regards,
Scott
What do you mean: Open?
Are you wanting an Open File dialog box, a Windows Explorer window with the Folder displayed?
Regards,
Scott
I want to open the folder as if someone when to the folder in a dir and opend it, so if someone clicked the command button it would automaticly open the folder, (not windows exlorer view), if this explination doesn't help let me know. thanx
That doesn't really help all that much, sorry :-( There are really only two ways to 'open' a folder. The two I mentioned above...
If you want the person to be able to browse through and open a file contained in that folder then you need the Open File Dialog box.
Otherwise, if you just want them to view the contents of the folder, (which includes unrestricted ability to interact with files, including opening, etc...) then you need to call the Windows Explorer. Here are instructions for how to implement the File Dialog box control, includes full code that you should need for opening whatever type of file that your users wish.
Regards,
Scott
That doesn't really help all that much, sorry :-( There are really only two ways to 'open' a folder. The two I mentioned above...
If you want the person to be able to browse through and open a file contained in that folder then you need the Open File Dialog box.
Otherwise, if you just want them to view the contents of the folder, (which includes unrestricted ability to interact with files, including opening, etc...) then you need to call the Windows Explorer. Here are instructions for how to implement the File Dialog box control, includes full code that you should need for opening whatever type of file that your users wish.
Regards,
Scott
ok, thanks, I have decided to go with the windows explorer to open the folder (since its o a network drive, i figure what hey , they can see there files , as aposed to letting the browse for the dir)
I now have a follow up question, This db reads emails and downloads the attachments to a folder, while commenting at the end of the email what the file(s) are (this is in a private sub), when opening the folder, how can I have only the file(s) download for that email displayed?
the line in the private sub to comment attachment(s) downloaded and location is : -
Me.Body = Me.Body & vbCrLf & locmsg & savefile & FileName & SeqNum & "." & Extension & vbNewLine
-
Me.[Body] is is textbox that contains the body of the email,
locmsg is just text to precede file location
fileName is the the name of the file
seqNum is the sequential # that is concatinated to the file name
This code is on the form that pulls the email from outlook
the form the end user uses to view this information does not contain this code because they are just pulling it from the DB table.
and help?
Thanx
ps. Im guessing the line to find there files would be somthing like : -
Len ( FileName&SeqNum) = 1 Then
-
.show
-
if you are wondering why the drive change it's simply because the process is the same but end result is for a multi user DB
In the link I gave you, you will find all the instructions you need in order to set up the folder browse dialog box, I strongly suggest using it instead of attempting to run the Windows Explorer, since there is no way to limit the Windows Explorer to the files/paths you are wanting.
In order to limit the opening ability of the users to only those files that are included in their email attachment you will need to slightly modify the code that is provided in the link.
I will give you an example and you can let me know if you need more help after trying this: -
Private Sub Command2_Click()
-
-
Const conVerticalOnly As Integer = 2
-
'Dim fsoSysObj As FileSystemObject
-
Dim fd As FileDialog, strFilesSelected As String, blnRetVal As Boolean
-
-
Set fd = Application.FileDialog(msoFileDialogFilePicker)
-
-
'Declare a variable to contain the path, it must be a Variant becase
-
'the For ... Each construct requires it
-
Dim vrtSelectedItem As Variant
-
-
Restart:
-
-
With fd
-
.AllowMultiSelect = False
-
.Title = "Browse Files"
-
If .Show = -1 Then
-
For Each vrtSelectedItem In .SelectedItems
-
If Left(vrtSelectedItem, 15) <> "D:\Access Code\" Then
-
MsgBox "Please select a valid path."
-
GoTo Restart:
-
End If
-
'Now, will only be one since MultiSelect = False
-
strFilesSelected = vrtSelectedItem
-
blnRetVal = Execute_Program(strFilesSelected, "", "")
-
Next vrtSelectedItem
-
Else
-
'The user pressed Cancel
-
End If
-
End With
-
-
Set fd = Nothing
-
-
Me!Text0.ScrollBars = conVerticalOnly
-
Me!Text0 = strFilesSelected
-
-
End Sub
This example restricts the users from opening any file that isn't located in a specific path, in this case: D:\Access Code\.
You will need to set a string variable that holds the FileName & SeqNum & "." & Extension information, then test your vrtSelectedItem to make sure it corresponds to the allowed file.
Regards,
Scott
As an aside, thanks for attempting to use the code tags! Instructions on their use:
Select your code text, then simply click on the # icon on the top of this reply window. To reflect the language, you can manually edit the first tag to look like this: [code=vb] for vba, change =sql for SQL, etc. Thanks!
Regards,
Scott
@Trevor2007
Following is the code sample used to display the outlook folder dialog using VB.NET - Dim objOutlook As Object
-
Dim objOlNamespace As Object
-
Dim objOlFolder As Object
-
-
objOutlook = CreateObject("Outlook.Application") ' create outlook application object at the run time
-
objOlNamespace = objOutlook.GetNamespace("MAPI")
-
objOlFolder = objContactsNS.PickFolder ' displays the folder dialog
-
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Phil Stanton |
last post by:
Can anyone let me have the code for opening the open file dialog box and
getting either a file or folder name as the output.
I suspect it will look like
Function GetPathOrFile(InputPath as...
|
by: Lee-Anne Waters via AccessMonster.com |
last post by:
Hi,
i'm hoping someone would be able to help with this.
what i need to do is to be able to open a set folder from a access form. at present i have to go into windows explorer and find the...
|
by: lauren quantrell |
last post by:
Is there a way to open the MS Outlook address book using VBA and then
be able to do something with the return value?
I want users to click an icon to open the Outlook address book then
when an...
|
by: dennist685 |
last post by:
Can't open my .mdb
I was experimenting with opening an access database in IIS. For
experimenting, I have an .mdb called HasbaraSample. In this case I copied it
to the C:\Inetpub\wwwroot\Access...
|
by: Niyazi |
last post by:
Hi,
I created application that store the data in SQL SERVER that reside on
network. The client also use this application to access the resources
provided with application. But is the client want...
|
by: jaccess |
last post by:
I was wondering if there is a simple way to open a specific folder from an access form button.
I have a form that a user can enter a date range and either view or print reports based on the date...
|
by: HowHow |
last post by:
I am using window XP, office 2000. Found out from internet that I can secure my folders in server if I zip and put a password to it. I did. However, when I try to open my Access from that Zip folder,...
|
by: Andy_Khosravi |
last post by:
I just recently changed my database that I'm running from a monolithic
DB to a split FE/BE. The front end resides on the client machine and
the BE resides on a network drive. I'm experimenting with...
|
by: Arno R |
last post by:
Hi all.
When I need to search for pictures, I always have too choose thumbnail-view manually.
Is it possible to open the common dialog in thumbnail-view programmatically?
Example ??
At the...
|
by: Chuck Anderson |
last post by:
I run Apache 2.0.55, and Php (both 4.4.1 and 5.2.5) on my home PC
(Windows XP). One of the scripts that I run daily needs to access a
secure URL (https://..............). When I am running Php4,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
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,...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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,...
| |