Excel Macro - Open Windows Explorer Window Using VBA?
Jun 6, 2002What's the code for opening a Windows Explorer window from within an Excel Macro?
View 7 RepliesWhat's the code for opening a Windows Explorer window from within an Excel Macro?
View 7 RepliesThe following 3 macros do the following.
1st macro . . . When the button is clicked for this macro, Windows Explorer is opened and the folder MyMenuFiles is selected. Works Fine.
2nd macro . . . When this button is clicked, the windows explorer opens with My Documents selected. Works Fine.
3rd macro . . . THIS IS THE PROBLEM ONE. When this button is clicked, windows explorer opens, with the C: drive selected. I want My Computer selected.
I'm sure this is really easy, but I'm learning and not having luck in the search option for previous posts. Thanks for your patience in advance.
I want to open a windows explorer window by using a button in Excel.
i use excel 2007, it s slow to open a file by double-clicking and entering from windows explorer, by googling i fould a fix by adding "%1" at the end of command in "Application used to perform action" (folder options/file types/xls/advance/open). however, to open files in the same instance, i have to keep "DDE message" with [open("%1")]. With both "%1", excel now opens twice.
How to fix it?
I have this module that is supposed to delete rows containing some words and those that are entirely empty..
The macro works fine when I open the file for the first time (excel as well) but subsequently if i try to run it again, the macro doesnt work anymore. What could possibly be causing this bug?
Private Sub DeleteRows()
ScreenUpdating = True
Dim Rng1 As Range
Dim X As String
X = " TOTAL"
Do
Set Rng1 = ActiveSheet.UsedRange. Find(X)
If Rng1 Is Nothing Then
Exit Do
Else
Rows(Rng1.Row).Delete
End If
Loop............
how to launch windows explorer from a path that resides in a cell using the code below.
Sub LaunchWindowsExplorer()
Dim PID As Double
Dim strRootPath As String
Const strExpExe = "explorer.exe"
Const strArg = " " '" /e,/root, "
'// Change rootpath here
strRootPath = "J:MyDirectoryWilliams,Bob 7264"
PID = Shell(strExpExe & strArg & strRootPath, 1)
End Sub
The problem I have is that once I have done this a number of times (probably somewhere between 80-100 times then I notice windows explorer starts to play up as if running out of memory. A reboot soon fixes that, however, I was wondering if there is anything I can add to the code to keep it from hogging up memory...if that is even possible.
When I say 80 - 100 times, I don't mean opening up 80 - 100 instances of windows explorer. I mean launching windows explorer, moving some files then closing that instance of windows explorer. Then coming back into excel and repeating that process.
I would like to have a macro button that will open the file location (path were the excel is stored) in MS explorer.
I found something like:
Sub ExplorePath()
Shell Environ("windir") & "Explorer.exe " & ActiveDocument.Path, vbMaximizedFocus
End Sub
But that give the error that an object is needed. Would that also work for MS Word?
Is there a way to copy the information in a Windows Explorer page into Excel?
For example, for any given folder or sub-folder in Explorer, I'd like to copy the NAMES of (i.e., not the file itself or the contents of the file) FILENAME, SIZE, TYPE, MODIFIED date, etc..
Perhaps, this question is much more related to Windows API but I thought of posting it here incase I get some more ideas.
I am looking forward to develop a program wherein I can prevent or avoid an Excel file being overwritten by a different file with the same name in the same location in windows explorer.
After a rapid search on the internet I have got something which I could use but that would just serve me the purpose of retreiving the overwritten file in windows explorer.
I am trying to launch windows explorer from within excel vba. The routine below is borrowed from another post on this site and modified for my purposes.
Sub LaunchWindowsExplorer()
Dim PID As Double
Dim strRootPath As String
Const strExpExe = "explorer.exe"
Const strArg = " " '" /e,/root, "
'// Change rootpath here
strRootPath = "J:MyDirectoryWilliams,Bob 7264" ..............
Two months ago our employer seriously limited the size of our mailboxes. We are "forced" to store emails as msg files on our network. PST archives are not allowed. This naturally sucks, as in Explorer you only have the file names and dates to look for that one particular email amongst hundreds (thousands) of msg files. I was able to compose a program in Excel 2010 that generates a list of msg files from a selected folder, together with metadata (sender, receiver, etc.) and so on.
In a test the program worked fine with 6,710 msg files I could post the code here, but the comments and many of the variable names are in Dutch (I never expected it to work in the first place). There is one thing I would like to add to the program. Sometimes I want to add an email to a new email as an attachment. Nowadays I have to look for the right msg file in Explorer by hand, which is a pitty, because I have the paths and filenames in my worksheet. I can put that in a string variable and let VBA do the looking up.
But I don't know how. I would like to be able to let VBA look for the file in Explorer, select it and then stop. I could then drag and drop the selected msg file in my new email. But all my attempts to find example code end up with code that enables a user to select a file and immediately open it. That is one step too far for me. If the msg file is opened, I cannot add it to a new email as an attachment anymore.
Every time I open a new file in excel it opens up the file and the other file I have open disappears. Can I open a file so that there will be two separate windows?
View 3 Replies View RelatedI have a VBA project that navigates to a website and then clicks on a link. When I click the link in my code a new IE Browser opens with a form that I wan to fill out. I know how to update the form, but I don't know how to reference the new browser window that was opened when I clicked on the link.
'Open End User Multiple Selection
Set tags = myIE.document.getElementsByTagName("A")
For Each tag In tags
If InStr(1, tag, "'multiple_selections.htm','EndUser'", vbTextCompare) > 0 Then
tag.Click
Exit For
End If
Next
when I try to reference the document in the popup window, it is still referencing the previous window. How can I set my "myIE" object to reference the new pop up window?
I am using the Application.GetOpenFilename command to open the window explorer view. Is there a way to minimize the selection to a particular doc type .
Example all Excel (xls) work book only or All Text (.TXT) only?
I'm trying to find an ID from a new open Internet Explorer Window.
I know that the ID that I'm trying to search for is "rBeginMonth_BeginDate", but my code always says that it's empty.
The code below is partially of what I've done.
[Code] .....
I have created a userform template and is working fine, the problem is the users are not able to minimize the template nor open any other excel files.
How to allow the template to open any other excel files or macro enabled files and also to minimize the windows.
I am trying to do something which is very slow and manual. What i have is like a seperate spreadsheet from every day and have to save each one down manually in the respective date. so for example column C has the date in already. Can you tell me how to save all the excel workbooks which are open (if i open them all) and then use the date in column C (which is in the format 20090217) and save it as a xls in the format 170209 and then close the workbooks?
sorry this is a huge question, just takes me so long to save them all.
I have a spread sheet that I have written that has 2 html links in it. The links work, but they only open in one browser tab. How do I get them to open in different tabs? Opening in two different browser sessions would be acceptable too. I have Excel 2007 and IE 9 but the users may have different versions.
View 7 Replies View RelatedI compared data between excel worksheets all the time, well recently my computer was upgraded from Windows XP to Windows 7 and since then I have not been able to figure out how to have an Excel file to open in the Excel window selected(or last active window) when I have more than one workbook open. Is there a way to do this?
View 5 Replies View RelatedI write a excel file (with macros included) to tackle the datas regarding stock market.
The excel file encompasses some information about financial reports, and some functions (macro) like sorting and filtering.
I'm wondering if I can build it as an windows 8 App and put it on the App market.
Or, in other words, can I make a windows 8 App by the functions in Excel ?
Can I do that ?
I was wondering if it is possible to use a macro open a folder in Windows Explorer. Previously someone on this forum taught me how to open an Excel file from a macro, but in this case there will be a new file every week. As the files will all be stored in the same folder, I thought it would be easier to open the folder in the normal Explorer view and select the file manually than to change the macro every week.
I am using Windows XP and Excel 2003. My programmes are run from the C drive, but my documents are stored on the E drive. What I am looking for really is a line that says: open in Explorer E:data
ewprocessed.
Working with Windows 7 and Office 2010
I've created a Excel workbook with VBA code to synchronize an Access database between a laptop and a server. One of the fields in the database is a shortcut to a jpg for each record. (The Access stuff is not too important here)
Now I'd like to add the ability synchronize the photos between the laptop and the server; so people who use the server can view the photos added by the laptop and vice versa.
Something like:
Code:
For each [JPG] in [LaptopFolder]
If not [JPG] exists in [ServerFolder] then
filecopy [LaptopFolder][JPG], [ServerFolder][JPG]
end if
next [JPG]
That code wouldn't work.
I have a project were i have to make a macro and place in a workbook such that as soon as i open that excel file
1. excel workbook is opened in New Excel window
2. Ribbon is hidden for this new window
i have tried with code stated below it hides the ribbon but new excel window is not open
Private sub Workbook_open()
Application.ExecuteExcel4Macro "Show.toolbar(""Ribbon"",False)"
End Sub
When I add hyperlinks into excel the picture shows up by using internet explorer when I want it to use windows picture and fax viewer.
How do I change it to open in windows picture and fax viewer???
I use Windows XP professional and Excel 2003 SP3
I have been given a macro recorded on a mac and it works fine with Mac Excel 2011. Unfortunately, I need to make it to work on a windows machine, but it comes up with an error message "macro unable to set width property of the window class. Run-time error 1004". When I press debug it takes me to the line .Width = 1456.
Below is the chunk of the code that becomes highlighted when pressing debug.
With ActiveWindow
.Width = 1456
.Height = 795
End With
i'm having trouble with the following code. The first if statement works fine, it's on the second pass that get problems, i get a 'ERROR 13 type mismatch' on the Windows(NewFN).activate line and i cannot figure out why.
Private Sub cmdsave_Click()
Dim NewFN As String
Range("B5:G21").Select
Selection.Copy
If Module3.firstTime = "y" Then
NewFN = worksheets "Recalculate").Range "G5").Value
".xls"
Workbooks.Add
I am using Excel2010.
My sheet displays values collected from a database via an AddIn. The values are updated by pressing CTRL+G (AddIn function).
I have an OnTime macro running SendKeys "^G" to update the values every minute. When the values exceed a certain limit, a sound is played from a custom Alarm function.
This all works as long as the excel window is active.
But if excel is minimized or another window is opened, the values stop updating until Excel is active again.
When the values dont update the sound is not played and that defeats the purpose of the sheet.
I've had a new machine, and for some reason if i try and open excel files by double-clicking on a .xls file, excel tries to open each part of the filename individually!!!!
For eg, if i have a file called week 1 report.xls, and i double click that, it gives me 3 messages saying:
cant find c:filepathweek.xls
cant find 1.xls
cant find report.xls
I can get round it by going into excel first, and opening the files from there but it's a right head-doer!!!
I'm on windows XP, and using excel 2003 to open the files...
I use the below code to close ALL open Internet Explorer pages. Im trying to adapt this to close ALL Windows Explorer Folders.
Dim Shell As Object
Dim IE As Object
Dim i As Variant
Set Shell = CreateObject("Shell.Application")
i = Shell.Windows.Count
On Error Resume Next
Do While i > 0
i = i - 1
Set IE = Shell.Windows(i)
If TypeName(IE.Document) = "HTMLDocument" Then IE.Quit
Loop
I have a few macros that need to work with various worksheets which are in different windows.
1. Make the user name the files a certain way for consistency
2. Make the user type the name of each window at the start of execution
I was wondering if there was a more flexible option though: one which would allow the user to choose from a list of open windows (similar to the Window>More Windows>Activate function in Excel).
Ideally the macro would run and say something like, "Which of the following open windows contains dataset1?" "Which of the following open windows contains dataset2?"