Opening External Files With VBA
Oct 31, 2007
On the first worksheet of my workbook I have a list of file names in cells I11:I27. The filenames have been 'compiled' using the concatenate function, so for example, although cell I11 displays:
Richard 2007-09.xls,
the cell contents are really:
=CONCATENATE(G20," ",L9,"-",J9,".xls")
Using VBA, I want to be able to open each respective file in cells I11:I27, copy the contents into this workbook (sheet=raw), and close it. My problem is that I don't know how to tell excel the filename in VBA, because the cells contents are not really the filename - they are a formula.
View 9 Replies
ADVERTISEMENT
May 5, 2014
I have a drawing index in excel sheet as shown below "there are thousands rows but here is only an example":
FILEID
TITLE
brd213962-1-1.pdf
SPECIAL PIPE SUPPORT DRAWING
brd213962-2-1.pdf
SPECIAL PIPE SUPPORT DRAWING
brd213962-3-1.pdf
SPECIAL PIPE SUPPORT DRAWING
brd213962-4-1.pdf
SPECIAL PIPE SUPPORT DRAWING
brd213962-5-1.pdf
SPECIAL PIPE SUPPORT DRAWING
And in the same folder I have all the drawings in PDF format and all the drawing are exactly named as listed under FILEID column.
I just want to click the drawing number in the excel sheet and get the drawing opened automatically.
Currently what I am doing is searching the index for a particular drawing and then searching the folder for that drawing to open.
View 1 Replies
View Related
May 2, 2009
I have 3 sheets: 1: master entry sheet that fills data in 5 different excel docs. Then there is another doc that aggregates data from the 5 and presents totals on the data. I am trying to get the end result without having to have 7 different excel files open, but when I enter into the master entry sheet, the data doesn't seem to be "pushed" up to the 5 different docs until each one is opened up. Obviously, the master aggregator is not updated since the 5 don't have the new data. When the files are all opened at the same time, the data flows perfectly, I'm just trying to find a way to avoid having to open the 5 docs in the middle of the process.
View 9 Replies
View Related
Apr 2, 2014
I have 50 files each with 1000 numbers in column A.
I need to compare every list with every other list and calculate the Pearson function.
I am ok with the vb code to compare every file with everyother.
I can do this by opening each file then closing but it takes too long.
Each of the 50 csv file names is in my destination workbook
I would like to define an array using the file name, then extract 2 lists without opening the files then perform the pearson function and place the value in the destination workbook. (The pearson function just measures the strength of correlation between 2 sets of numbers)
View 4 Replies
View Related
Oct 30, 2009
if it is possible to have one xls file load all .xls files that are inside a folder or a folder with subfolders and so on?
View 9 Replies
View Related
Dec 6, 2006
I want to link data between two files, which are always in the same position relative to each other, but can be copied to other locations. Here is an example:
D:Job 1SourceJob Info.xls
D:Job 1SlaveClient Form.xls
Cell B1 in Client Form.xls refers to Cell A1 in Job Info.xls. This link is created when both files are open. When Job Info.xls is closed, the reference in Client Form changes to 'D:Job 1Source[Job Info.xls]Sheet1'!$A$1.
Then, I copy and save Job 1 as Job 2. Thus, the second set of folders are: ....
View 7 Replies
View Related
Apr 28, 2003
I have 12 external files (one per month) and need a quick way to pull these into a reporting book. I've used the following code...
Workbooks.Open FileName:= _
"J:ManfinMISNew ReportingMIS2P200301.xls"
Columns("A:B").Select
Selection.Copy
Windows("MainReportingBook.xls").Activate
Sheets("P200301").Select
Range("A1").Select
ActiveSheet.Paste
Windows("P200301.xls").Activate
Call OpenClipboard(0&): Call EmptyClipboard: Call CloseClipboard
ActiveWindow.Close
However with 10000++ rows of data in each file, this is very very slow (approx 5 mins to update all 12 months).
View 9 Replies
View Related
Aug 26, 2013
I have a list of file locations of .pdf files in column A of my spreadsheet. All the path and files have info on Sheet1.
i.e. Column A1 c: estpacking_1.pdf A2 c: estcountry_1.pdf
Can I use VBA to, when I run it, print all of the files in the list in column A1:D20?
View 1 Replies
View Related
Apr 13, 2009
to fix a .xls file that wasn't created by me.
In order to do that I need to change the path of an External Data that is an access 2003 file (.mdb file).
The only way that I imagine it is possible is to select a cell that is an adress for the query result, than click on properties and change it selecting the new path of file (the path moves depending on the user of the .xls).
View 9 Replies
View Related
Sep 11, 2009
I'd be very grateful if s.o. help me find solution for the following task:
I want to fill certain worksheet with data from external .tsv files. The .tsv files are with a almost a common name (something_date.tsv), located in folders for each month.
What I'm usually doing and want to automate:
- I'm opening the first .tsv file from the monthly folder;
- Creating AutoFilter on the first row;
- Selecting a custom criteria from the AutoFilter;
- Copying the cells matching this AutoFilter criteria;
- Pasting in a predefined worksheet (with AutoFilter on first row);
*All of the copied cells are not being altered in the predefined worksheet, i.e. the first rows of the .tsv file and the worksheet are the same.
- Doing exactly the same with the next file in the monthly folder (but pasting below the already copied cells in the workbook).
- Etc.;
- Etc.;
View 14 Replies
View Related
Aug 14, 2003
How can I use VBA to open a .chm file. I tried using many different methods but with no success, i.e. openfilename.
View 6 Replies
View Related
Jun 11, 2007
i wish my vba program to enable the user to select a file to open from the regular 'open file' dialog box.
in addition, I wish to be able to list the filenames in a user form that have already been saved in a specific directory.
View 9 Replies
View Related
Apr 25, 2006
I am trying to view a csv file that has string data, some of them like '395E02'. Excel automatically converts this string into an exponential number. Is there any way to stop Excel from performing the conversion so I can read the number as is?
View 8 Replies
View Related
Jul 23, 2013
I have the following code which edits an excel file and saves it in a different format, I think want the code to take this newly saved file and open it in an external application (Softplot) and then save it through this new application.
VB:
Sub FormatMacro1a(ws As Worksheet)
ws.Copy
Rows(1).Delete
Columns("D:E").Cut Destination:=Columns("J:K")
Columns("F:K").Cut Destination:=Columns("D:I")
Range("E1:E201").Value = "0"
[Code] .....
As it stands I have the file saving in a new format and I can open a specific file in softplot through VBA however where I am getting stuck is opening my newly saved file and then saving it.
I have tried the following :
VB:
Path = "C:Program FilesSoftPlot-8softplot.exe"
File = "ActiveWorkbook"
View 3 Replies
View Related
Mar 12, 2007
Last monday I clicked on my quick launch icon for my time card, which is in excel. It opened up, but I got an error message saying that excel had an error, send report or don't send report. Closed everthing out and clicked on the icon again, but this time excel oppend but the file did not. I get just a blank (don't know what to call it) spreadsheet. There are no cells to enter anything in. I do get the "File, Edit, View, and so on" at the top. I can click on File than Open and browes for the file and open it that way, but I can't open any Excel file by double clicking it in explorer.
View 10 Replies
View Related
Nov 25, 2008
I am trying to write a program that will open a group of files whose name is in the format S1T1C1.vfc where the S1T1 part of the name will remain constant (S refers to subject number and T refers to trial number) but the "C1" (condition) will be different every time since we randomize our trials. I have a working loop that will open all the trials for a particular subject but only if I remove the last two letters of the file name in the folder. Is there a way to only look at the first part of the file name (which will be unique) and ignore the last two characters?
View 2 Replies
View Related
Nov 27, 2009
I am trying to come up with a macro that is able to open a .htm file in Excel, perform a set of code, close the file, then repeat the process with the next .htm file in the folder. I found the following post which has helped me thus far, but there is something that is not allowing Excel to open the .htm files even though there is no problem opening them in Excel manually or with another macro I've made. Here is the link to the set of code I'm currently working with:
http://www.excelforum.com/excel-prog...-a-folder.html
I've put some .xls and .csv files into the target folder and the program works perfectly which tells me Excel is having a problem with the .htm format for some reason. Here is the set of code I currently have which I have slightly modified for the new file format:
View 3 Replies
View Related
Apr 5, 2013
I need to open all files in a folder to modify a date in the first line. The files have a .cdr extn for a particular application but are basically text files with xml type tags. What would be the best way to proceed?
I tried opening as text in VBA but they are blank.
View 1 Replies
View Related
Aug 7, 2008
I'd like is for an automatic job to be set up on my machine (windows) that opens the CSV files, formats them, then closes the file (as a .xls doc). So that anyone subsequently opening the file opens a formatted spredsheet.
I tried setting up the auto_open macro function, but I have trouble because I need to select the data (which is in delimited csv format) before I run the formatting routine, opening the file and running the file can't cope with this because the selection (Col A) has not been made even though I include the column selection before the formatting when recording the auto_open macro.
the error reported is:
runtime error 1004:
no data to parse
So is there a way of doing this??
To format the data, I use the following steps:
1, Select column A
2, Data>Text to columns>delimited>~ (~is the delimiter)
3, Column data format text for col A & B
4, Select all (top lh box above cells)
5, auto column width (double click on a column boundary)
6, select columns C to I
7, centre justify
example of csv data:
Site~Pipe~:Lsno~:MMSSid~:MMSControl~:MMSStatus~Bore~Pspec~:CTLTargetted
/PTE2D~/ADMIN-TEST~730001~-6727~YES~0~50~13459N~60%
View 10 Replies
View Related
Feb 5, 2010
i want to write a macro for opening 200 excel files file names start with report0,report1,report2..................report200
View 9 Replies
View Related
Mar 21, 2003
I have several text files in a folder which I wish to open one at a time in order to copy the data into a spreadsheet.
e.g. I want to open text file #1, copy the data, then close the file, open text file #2 copy the data and close the file, and so on for all of the files in the directory.
View 9 Replies
View Related
Mar 7, 2014
I am trying to put this in about 25 cells to point at 25 different files. Basically I am trying to keep an eye on when the files have been updated each morning so that I can then pull off some data from them and who saved it.
I solved the first part (see next post) but I still havent been able to get it a function pull off the username.
View 1 Replies
View Related
Nov 7, 2013
I have Mac 2008 Excel. For my work, I download .asp files and open them in Excel. No problem. The problem is... I'm wanting to use another computer at work that has Mac 2011. When I open the exact same .asp files, they show coding (html?). I can fix this by changing the name of the file extension from ".asp" to ".xls." But I convert these files a lot during the day and this is an extra step I don't want to take. And it works fine in version 2008. So what can I do in version 2011 to make it open the files without all the coding?
View 2 Replies
View Related
Jul 30, 2014
I would like to be able to open multiple .txt files into one excel document. I had been using a code that opened all the files I wanted into a NEW excel document. I have a template that I use and I want the files to open in sheets following the main template sheet. This is what I have been using:
Sub CombineTextFiles()
Dim FilesToOpen
Dim x As Integer
[Code]...
And it worked just fine for that purpose but how could I edit this?
how I could use VBA to make a table out of data that would be cool too.
View 3 Replies
View Related
Dec 2, 2008
I have a long list of .xls files. I have to open each file, copy a few columns of data and paste it into a single xls file. I can write a macro to do this, the only problem I have is how do I get the macro to open all the xls files with different names ? I am thinking something like sorting the files by date and then let the macro open files from the oldest to the most recent one, but is there a command to do that ?
View 6 Replies
View Related
Sep 22, 2009
I am trying to write a Macro that will do the following.
1. Using a new workbook
2. Open a file in a in a directory. Then
3. Run a vlookup using the opened file as the filename in the vlookup
4. Paste the results of the vlookup into the original file next to the file name.
5. Close the file and open the next one in the folder.
The folder contains about 2k files that it needs to loop through. I found a macro on this site created by Ravishankar and attempted to add to it. Not going so well.
View 2 Replies
View Related
Jan 28, 2012
I have the following codes for 2 command buttons for a userform.However, the following codes opens the excel files that I've selected.The results that I want is to have a third command button such that when it is clicked then it will open the 2 files specified on the 2 textbox.How do i modify the codes?
Code:
Private Sub CommandButton1_Click()
Dim f As FileDialog
Set f = Application.FileDialog(msoFileDialogFilePicker)[code]......
View 5 Replies
View Related
Sep 20, 2012
I have a csv file. When I open it by double clicking, all the finance figures appear as currency with the currency symbol. I can use the SUM function on these and it's perfect.
However, when I open this file using a macro, these same numbers look the same, except that they are now left justified and are text because the SUM function no longer works. If I select a range, I get the count of the number of items selected showing at the bottom of the screen but not the sum.
I have tried opening the file using the OpenText function which has several ways of setting a date format to the fields but nothing for numbers.
I have even tried, in the macro, selecting a cell with numeric 1 and then selecting the range and pasting the 1 as a multiply function but this doesn't work either.
View 2 Replies
View Related
Apr 25, 2013
I tried to search for threads about opening files from multiple subfolders but the following codes does not open files. Could someone please check and edit the code that I have below:
Dim lCount As Long
Dim wbResults As Workbook
Dim wbCodeBook As Workbook
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False
On Error Resume Next
[Code] ........
View 7 Replies
View Related
Jun 25, 2014
I am working on a worksheet with quite a few advisors who will be using the sheet, because of this reason I am trying to cover my back with as much error handling with my VBA script as possible. Where I am struggling is the following line:
Code:
Set cb = Workbooks.Open("wilm-dchome"UserName"DesktopCurrent projectPipeline Grouped.xlsm")
I want to have an error handler that says if this file cannot be found use the following line of code instead:
Code:
Set cb = Workbooks.Open(Application.GetOpenFilename())
It may even be just a simple if statement instead but I cant seem to find the answer.
View 2 Replies
View Related