Allow User To Choose Folder/File To Open
Apr 18, 2008I am trying to open a folder so I may choose the workbook to open. I am able to open a workbook but I want to open the folder which contains the workbook.
View 6 RepliesI am trying to open a folder so I may choose the workbook to open. I am able to open a workbook but I want to open the folder which contains the workbook.
View 6 RepliesWe have several salespeople who maintain a workbook tracking their workflow. I want to compile the customer account number, account name and deal number for each rep to another workbook. A new sourcebook is started each week. This code is in the target book
'Option Explicit
Public sourcebook As Object 'the workflow workbook
Sub GETDATA()
Dim wsc As Double 'the number of pages in the workflow
Dim col As Long 'the column in this workbook for returning values
Dim IntEndRow As Double 'the end row in this book
Dim SrcEndRow As Double 'the end row in workflow
Dim findval 'the column workflow where the sourcedata is found
My code allows the user to select a workbook and then loops through each sheet in that book searching for the column which has the info I need, this changes on each sheet as the reps each deal with different types of customer as so take different details. I solved this by having column headers in the target book and searching for them in the sourcebook.
This code works when I step through it but falls over at the "Set sourcebook" line when I run it where it returns a breakpoint error.
I have code (below) that works if the range "ImportFile2" contains a valid value but I want users to be able to select any .csv file preferably from a directory which should be held in a cell.
I added ...
I am making a macro that requires that user to enter a directory path into a input box and the macro will open the file. Right now it works fine bit i would like to change the code so that instead of using an input box it brings up a box that will allow them to browse files on their computer and then select one to open.
View 4 Replies View RelatedI 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?"
I have a control button that uses this code
ChDir "H:EMCARCHIVE"
varFileName = Application. GetOpenFilename("Excel Files (*.csv), *.csv, (*.xls), *.xls")
however the files list but when you select any one of them they do not open and the file name is not displayed in the filename box
can you let me know why the files do not open
I use Excel 2003 at work. I'm looking for some code that will Open a folder and then lets the user to select a file then continues to run the macro.
The file name they select will look similar to this K2271011.504 or K3011111.201
The macro works when I have my user name in the path but when I try to insert an environment it does not work.
View 3 Replies View RelatedI am trying to open a website, then for excel to download the csv file, then for it to save it in a specific folder under a specific name and file format (excel).
I am successful at opening the website with the following code, but how to do the rest.
Sub Searchez()
Dim IE As Object
Set IE = CreateObject("InternetExplorer.Application")
IE.Navigate "http://quote.morningstar.ca/Quicktakes/stock/keyratios.aspx?t=clwr®ion=USA&culture=en-CA&ops=clear" 'load web page google.com
IE.Visible = True
While IE.Busy
DoEvents
Wend
'IE.Navigate2 "javascript:SRT_keystuts.exportcsv()"
'this is the name of the download link as from when i hover my pointer over download link.
End Sub
I need to open all the excel file in a sub folder
(example : CCostingAccount*.*.xls)
It mean by run a macro, it will allow me to be open all excel file in the Account folder .
I am using the code below to Open the most recent file in a folder.But once it Identifies the most recent file I get a run time error"1004"
xxxxxxxxxxxxx(name of File) could't be found.At line "Wookbooks.Open strFilename".My question is , why can't it open it, it has the location and the file name?
This code works as long as the macro and target file are in the same directory(Folder)
I am using excel 2007 and I’m trying to open a file folder from a worksheet using a control button. They are both in same file folder. I’ve have tried
Workbooks.Open Filename:=ThisWorkbook.Path & "Report"
I also tried to record a macro but would not record going to file folder.
I am using below code to open file from 2 diff. folder and trying to do vlookup.
Its working in single loop but not moving to next file
Error: Invalid procedure or call argument.
Sub vFunction()
Dim strTempName As String
Dim strPath As String
Dim wb As Workbook
Dim wb1 As Workbook
Dim strFile As String
Dim strFile1 As String
[Code] ...........
I have a folder called 'Refresh'. Every week a new file is dropped into that folder. Instead of me placing that new file into my workbook, i would like my macro to just grab it. Is there a way for VB to grab the most recently created file that comes into my 'Refresh' Folder.
View 9 Replies View RelatedAnyone up for getting me started on code to open a file in a "dynamic" directory, specifically:
Where
Main directory is G:REPORTS
The file name is "Pivot_xx-xx-xx.xls"
The directory where the file is located is G:REPORTSxx-xx-xx
xx-xx-xx is yesterday's date
I am trying to write a macro to find a file in a specific folder. The file name changes weekly. (Ex. C:My Folder31207.xls). I need to find the most recently modified version of the file and open it.
View 4 Replies View RelatedI would like to run a macro that is going to open a file (Test.xls) Simple so far....
However, this file is 1. stored every month in a different folder (eg: 200709,200710, etc..) and the file is named according to the month (eg: Test09.xls, Test10.xls, etc...)
In my excel book, I did created two cells which I already use to save a document according to those cells. One cell with Acct Period (200710) and another one with the month (10).
I have tried the following formula with no success:
OpenWorkbook "\pathpathpath" & Range("Accout Period") & "Test" & Range("Month") & ".xls"
I was looking over web for a vba code that will open yesterdays last modified (saved) file in a specific folder.
In these folder is for eac day one file, so it has to open yesterday, not today - yesterday last saved (modified).
I just need a macro to open any excel file may be 2003, or 2007 from a folder.
I did tried Dir but not working. I want the macro in 2007.
I have to open each pdf file in a specific folder, select and copy all contents and paste it in column 'A' of a new workbook.
I have tried following code but not worked...
Code:
Sub ConvertPDF(control As IRibbonControl)
Dim AdobeApp As String
Dim AdobeFile As String
Dim StartAdobe
Dim fso As New FileSystemObject
[Code]...
I have Acrobat Reader installed. Any method without using 'SendKeys'?
I Want make a code to open (OPEN File Dialog)
and it works good I can't change the Diroctory!
Sub OpenFile()
fileToOpen = Application. GetOpenFilename("Execl Files ( *.xls), *.xls")
ChDir "C:" ' Not work good
If fileToOpen <> False Then
Workbooks.Open Filename:=fileToOpen
Else
Exit Sub
End If
End Sub
check this code.
I have a requirement to search workbooks in a particular folder with specific string in file name. For example, let us assume I need to find a file which contains the name 'RR' in it. The position of 'RR' will vary with files i.e. 'RR' might be present either in the beginning, middle or at the end of file name. All I wanted is to search for file with 'RR' and do some activity and close the file and then goto next file. Similarly, the next search has to be performed with the files containing the name 'BB' in it.
View 1 Replies View RelatedI am writing code that requires data from another workbook. Instead of hardcoding the directory and filename (which changes daily), how can I have the code prompt the user to do this for me?
I want to open the file with:
links updated
read-only
Also, is there a way to have an initial directory that appears so the user need not go through a dozen directories every time to get to the file?
I have code that prompts the user to open a specific excel file. However, with the following:
Filepath = "..."
name = Application.GetOpenFilename(FileFilter:="Excel Files *.xls* (*.xls*),",)
Workbooks.Open name
the default directory you start out in in the window that prompts the user to select a file is NOT ...
How can I properly assign which directory the user starts in so they need not go through 10 sub-directories everytime they run this code?
I want to open a user defined file name in excel and then activate it , to run a macro on it.
View 3 Replies View RelatedI have an Excel Worksheet (let's call it "AA.xlsm") which uses VBA code to loop through column A, update column B with some results/values, and then (for each value in column A) SaveAs the worksheet into a different filename/path as a ".csv" type file.
My line of code for the SaveAs is as follows: Workbooks("AA.xlsm").SaveAs LEpath & CurrFldr, FileFormat:=xlCSV
My problem is that my original worksheet, AA.xlsm, gets closed whereas I need it to stay open/active after each SaveAs iteration.
I'm trying to write a macro that will bring up the "File Open" dialog box, and allow the user to navigate to the directory where the file is located. It won't be the same file every time, and the files will likely have different names.
View 14 Replies View RelatedThe code below opens a window which allows the user to select a file to open. Apparently, it starts in the directory of the file containing the macro. How would I modify this to open in "M:Archived PO ResponsesProcessed"?
View 3 Replies View RelatedI have a program that opens an excel-workbook, I first check whether the file is opened by another user(open for read-write). This works fine, but I'd like to know which user has the file open with VBa code. ex.
workbooks.open ....
if open
then msgbox " Book opened by user"
end if
So it's the same as you open an excel(with your windows explorer) on a network and you get the message that the file is already opened by the user....
Its been a while since I did this on 2003 and needing a pointer on 2007.
Just needing a simple macro that opens the relevant folder from a hardcoded path to allow the user to manually select the file to be used.
This file will then be used to copy from and paste to another file.