How To Read All The Filenames From Local Drive ?
Dec 3, 2008
I need to know how to read a filename from my local drive c: ? for example in my local drive i have some 100 files, i need to pick there filename, date and time stamp .. etc.
View 7 Replies
ADVERTISEMENT
Mar 31, 2014
I want to list file names from a directory and sub directories and hyperlink them. I have been able to list the file names onto an excel sheet, but I cannot get it to hyperlink to the file.
'Force the explicit delcaration of variables
Option Explicit
Sub ListFiles()
[Code]....
View 1 Replies
View Related
Jan 4, 2007
I'm trying to open a file on a network drive...but I'm getting the following error message when it opens: "This file may be read-only, or you may be trying to access a read-only location. Or the server the document is stored on may not be responding." Now, the file itself has no rights restrictions and is not read only. It doesn't appear to be locked.
Now, there are other Excel files in the same directory which I could open fine; however, the Excel documents having the above problem all have a little black icon "appears to be a padlock" (image attached) at the bottom left hand side of the Excel file icon. I tried the following:
- Renaming
- Converting to a different file format (didn't work, it won't let me)
- Opening in notepad...etc doesn't work.
This file is dated back in 2004...do you think it's corrupt? Is there anything i can do to open or recover this?
View 2 Replies
View Related
Nov 14, 2009
I want to schedule a report to run overnight when I'm not at work, and it needs to save as a filename with the previous day included in it
For example, the filename needs to be saved as
C:Test_variable_ver1.xls where variable is equal to day(today()-1) in excel terms.
View 3 Replies
View Related
Feb 9, 2009
I have a folder which contains a number files. What I would like to do is for my spreadsheet to look into that folder and write the filenames to the sheet. And everytime i run it, the file names are just added on.
View 4 Replies
View Related
Jul 20, 2006
I have about 50 CSV files in a directory and would like to list them in a column that I can use them to populate a box so that a user can select the file they want in the box and open it in a new spreadsheet.
I have tried several ways to do this but nothing I do works.
At present I am using an imput box for the user to type in the filename, but if they type incorrectly, or type in a file name that doesnt exist the program just exits because of my error trap.
View 3 Replies
View Related
Jan 10, 2007
I have created a form wherein i have created a textbox to enter the excel filename and three different combobox to select the year, month and the day respectively. These are actually the folders on my hard drive and the excel files which i want to open is inside these folders with similar names. I want to search these files for the selected year, month and day from the combobox. The filename will be provided in the textbox. the path for the files is say c:yearmonthday*.xls
View 6 Replies
View Related
Mar 7, 2007
I would like to, using VBA, assign a hyperlink to an excel cell that links to another worksheet within the same workbook. I've tried the forums, and combined with a previous post and MS Excel Help File, I've come up with the following attempt:
With Worksheets("Test Destination")
.Hyperlinks.Add Anchor:=.Cells(counter + 4, 5), Address:=strHyper2, _
TextToDisplay:=(#1/1/2007# + counter)
End With
strHyper2 is previously defined: strHyper2 = "[WeatherTester.xls]1!A1"
My spreadsheet file is "WeatherTester.xls", my worksheet is "1", and "A1" is the desired link location for the cursor. Counter is an integer. I get the error "Invalid procedure call or argument". I also tried to enter a hyperlink directly through the formula property, but Excel didn't like the single quotations I had to use within the HYPERLINK function. The hyperlink formula works in the following form: =HYPERLINK("[WeatherTester.xls]1!A1","1 Jan")
View 3 Replies
View Related
Feb 21, 2009
Our state carries a 4% sales tax on all items except food and prescriptions.
Our county carries a 3% sales tax on everything.
Attached on my work sheet:
Column "C" determines if an item is either food or non-food.
"G5" is the subtotal of column G
"G4" is the S/tx on "G5" at 3%
"G3" is the S/tx on "G5" at 4%.
"G2" is the gross pay out.
My question is:
I'd like a formula for Cells "G3" and "G4" that can determine which items paid for in column "G" match a "N" or an "NF" in column "C".
If an item in column "G" represents a "F" in column "C", then there should not be anything in cell "G4" If an item in column "G" represents a "NF" in column "C", then there should be a figure in "G3" & "G4".
View 2 Replies
View Related
Sep 22, 2010
I need tht How to rename the Filenames in an Folder using macro.. Is it possible, How we can do it..
Example: In an Folder 200files are there with extension .jpg/xls/bmp/txt/doc files, I want to rename tht those files names,
Example1:
Source File: TestImage.jpg
I want rename as
Destination file : image.jpg.
Not only Single file rename..if I want to rename Bulk means?...
View 14 Replies
View Related
Jan 21, 2014
I am attempting to split my workbook and save the sheets as individual files. Simple enough? yes. The issue I am running into is that when the sheets export I want their filename to be pulled from the value of a cell on a master control sheet. While I am pretty sure these can be done separately, not sure how to really do them as a whole within a one click button. Also an issue I am running into is that when I click my export button on my control page, the sheets that are saved have lost some of the page formatting.
SHEET1 is my control sheet
Here is the code that I was using to export the sheets.
[Code] ......
View 9 Replies
View Related
Jun 3, 2006
I'm trying to retrive files from a given directory into excel.
I already have this file from another posted message:
Sub GetFileNames()
Dim F As Long
Dim FileName As String
Dim TheNames As Variant
ReDim TheNames(1 To 1)
FileName = Dir$("*.*")
Do While Len(FileName)
F = F + 1
ReDim Preserve TheNames(1 To F)
TheNames(F) = FileName
FileName = Dir$()
Loop
Cells(1, 1).Resize(F, 1).Value = Application.Transpose(TheNames)
End Sub
But I want to be able to set the path myself
View 11 Replies
View Related
Dec 19, 2013
Have an array that contains file names similar to these:
\serversharesmysharesomefolder3_s6_macro_cycle22_2Ft10p75.txt
\serversharesmysharesomefolder1_s6_macro_cycle22_2Ft10p75.txt
\serversharesmysharesomefolder25_s6_macro_cycle22_2Ft10p75.txt
\serversharesmysharesomefolder32_s6_macro_cycle22_2Ft10p75.txt
I need to sort the array in ascending order based on the file name. The file name is after the last “” and starts with a number(s). From my example above I would like the resulting sort order to look like this:
\serversharesmysharesomefolder1_s6_macro_cycle22_2Ft10p75.txt
\serversharesmysharesomefolder3_s6_macro_cycle22_2Ft10p75.txt
\serversharesmysharesomefolder25_s6_macro_cycle22_2Ft10p75.txt
\serversharesmysharesomefolder32_s6_macro_cycle22_2Ft10p75.txt
I want to use the Application.GetOpenFilename to populate the array and then process the filenames.
I assumed you data starts in "A1"
Results start "F1"
Code:
Sub MG19Dec38()
Dim varFiles As Variant ' used to hold array of file to open
Dim ray
Dim j As Long, i As Long
Dim Temp1 As Integer
Dim Temp2 As Integer
Dim Tem As String
' ray = Application.GetOpenFilename("Txt Files (*.txt), *.txt", , , , True)
View 2 Replies
View Related
Sep 2, 2009
I have a userform which prompts a user to select two files from the directory. Once these two files are open I will extract data from one into the other, the only problem is these filenames will change and I need to be able to determine what their names are.
I have this code below:
Private Sub CommandButton1_Click()
FiletoOpen = Application.GetOpenFilename _
(Title:="Please choose a file", _
FileFilter:="Excel Files *.xls (*.xls),")
If FiletoOpen = False Then
MsgBox "No file specified."
Exit Sub
Else
Filename1 = FiletoOpen
TextBox1.Value = Filename1
End If
End Sub
If I could somehow extract the exact filename, not full path, from the variables Filename1 and Filename2 I would be fine I guess, I just don't know how to do that.
View 9 Replies
View Related
May 8, 2006
I am working on a process model, which requires that the same basic procedure be carried out for each unit in the process.
One worksheet is allocated to each unit with data concerning the flow streams being passed from the previous unit and the product being linked to the next unit. Although the same procedure is therefore being followed on each sheet, the input data differs.
I currently have the code to perform the required technical operations and calculations for a single unit. This code is very much dependent on named ranges.
I want to use the same core to perform the routine-operations, but need either unique named ranges on each page or I need a way to define name that is limited to the specific worksheet on which it is located.
For example, I might have an input range for a heater and splitter, with a technical add-in in VBA performing calculations on the input for each unit. How can I use two separate instances of the name "Input" instead of "Input_Heater" and "Input_Splitter"?
View 3 Replies
View Related
Jul 16, 2006
The default program for opening JPG files is "Windows picture and fax viewer" which is fine with one of my colleagues. Upon declaring and clicking on a Hyperlink, to a JPG fle, the picture is opened in "Microsoft photo editor". How can one define the program in which Pictures opens via Hyperlinks will be displayed!? (WINXP & Office 2002)
View 3 Replies
View Related
Sep 21, 2006
I took this code from another post and modified it slightly to look in my directory "C:cherylpostal" and list the names of all the files contained. I then have them displayed in a combo box. They are all CSV files, but I would really like them to appear without the .CSV extension. For example, my COQ4 file appears as COQ4.CSV but I would like it to just display COQ4. I can't seem to make it work however.
Sub Macro1()
Dim rngOut As Range
Dim strPath As String
Dim strFile As String
Set rngOut = Range("F1")
strPath = "C:cherylpostal"
strFile = Dir(strPath & "*.*")
If strFile = "" Then
MsgBox "No files matching criteria can be found in " & strPath, vbExclamation
Exit Sub
End If
Do While strFile <> ""
rngOut = strFile
Set rngOut = rngOut.Offset(1, 0)
strFile = Dir
Loop
End Sub
View 5 Replies
View Related
Apr 14, 2014
30 people in different countries use a sophisticated VBA Excel file on their local PCs, let's call it myexcelfile.xls. This file contains no custom data, as all data is stored in myexcelfile_backup.xls.
The biggest challenge with this set up is that whenever there is a newer release or bugfix of myexcelfile.xls, I need to send it out per email to 30 people and hope they replace it with my updated version.
Note that newer versions can replace older versions without any data loss, as all data is stored in the backup file.
Idea: with tools like WGET or BITSADMIN, I was thinking of creating a batch file, that would simply download the latest version from a FTP server, and replace the older version with the newly downloaded one.
Constraints: I shouldn't be using any software that is not native to Windows 7the files can sit in different folders on these 30 computers, therefore the update mechanism would have to identify the path they are in.the update mechanism would have to close the file first before running the update. Question: What is the best way to go about this? A DOS Batch file? Or another excel file that is just the "updater", meaning, it's only purpose is to download the new file from the web and overwrite the old file?
View 1 Replies
View Related
Feb 17, 2009
I have a macros in my spreadsheet when I open it a number in the macros goes up 1 each time the worksheet is opened. I want to put this file on a server that can be accessed by various people. The problem I am getting is every time someone opens it from a different location with a different PC the number starts at 1 again. I want to keep the number going up 1 each time no matter who opens it.
View 4 Replies
View Related
Apr 26, 2009
I have Excel 2003 SP3 on Vista Home Basic fully patched. My code runs very slowly until I pull out the ethernet cable then it runs quickly.
View 9 Replies
View Related
Jan 28, 2010
I have a program operating in excel 2007 that extracts a picture from a URL and puts it into a PPT slide. I now discover that PPT 2007 doesn't allow this.
So my intent now is to download the jpg into a local file and then import into the PPT.
This is from a couple of sites:
[url]
[url]
At the top of the code:
Option Explicit
Private Declare Function URLDownloadToFile Lib "urlmon" Alias "URLDownloadToFileA" _
(ByVal pCaller As Long, _
ByVal szURL As String, _
ByVal szFileName As String, _
ByVal dwReserved As Long, _
ByVal lpfnCB As Long) As Long
in the excel cell if a URL picture needs to be inserted it starts with the prefix "picture=" then the http address.
This did not work.
So I then copied the code from the websites into a module (changing the destination file and URL to mine of course) and called the procedure and still nothing.
View 7 Replies
View Related
May 5, 2006
I have done a search in the forum, and there are many results on browsing directory and opening files, but they are not what I have in mind.
What I have is different folders for different months (e.g. January, February, March and so on), and in each folder I have the same file names (e.g., in January folder, I have files called A, B, C. In February, I also have files A, B, C but these are different from the files in other folders)
Basically I need a macro which can open a specific list of files.
So first step, the user should be able to browse the directory, then select a folder (no need to open, not sure if it makes any difference though). I need the user to be able to select different folders because the macro should work for the different months in different years.
For this, I have found this
Function GetFolderPath() As String
Dim oShell As Object
Set oShell = CreateObject("Shell.Application"). _
BrowseForFolder(0, "Please select folder", 0, "c:\")
If Not oShell Is Nothing Then
GetFolderPath = oShell.Items.Item.Path
Else
GetFolderPath = vbNullString
End If
Set oShell = Nothing
End Function...........
View 9 Replies
View Related
May 20, 2006
use an address in a cell and http://local.live.com/. i would like to paste an address into http://local.live.com/ from a cell (or concatenation) into the "Where" textbox...?
View 2 Replies
View Related
Jun 18, 2006
I am trying to wirte a macro that will allow my users to import data from a HTML file locatedon their local hard drive. THe directory information will not change however I would like the opporutnity to "choose" the appropriate file prior to completing the macro. Do I need to construct a form first?
Sub QuestionGetExtData()
Range("H11").Select
With ActiveSheet.QueryTables.Add(Connection:= _
"URL;C:foofoo.html" _
, Destination:=Range("A11"))
.Name = "foo.html"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False......................
View 2 Replies
View Related
Feb 2, 2007
I have an Excel 2003 application that automatically opens and closes a lot of workbooks. When done with a workbook, I close it with: ActiveWorkbook.Close SaveChanges:=False
On most users' machines, this works well. On one user's machine, the procedure is still asking: " Do you want to save the changes you made to 'filename'? "
at each workbook close. Considering that a typical run might inspect over 2,000 workbooks, this is a problem for the user. Is there a setting that can override "SaveChanges:=False"?. If so, where would I find it, and how would I programmatically turn it on/off?
View 2 Replies
View Related
May 4, 2007
I'm working on a spreadsheet that will connect to a firebird DB (Programmed using VBA and ADO intially).. The spreadsheet itself will reside on a server in a shared folder..
When a user opens the file up, I'd like for the spreadsheet to use the servers ODBC connection, and not the client machine.. This way we don't have to install the Firebird ODBC driver on each client workstation..
View 9 Replies
View Related
Apr 14, 2014
i want to use the "Browse for Folder" to select the folder where the files is in eg. E:My DocsGlobal and list the folder location and filenames to table (column I:J), and color them according to every folder location.
I would like the "Browse for Folder" windows to be able to select multiple files instead of just one file a time.
View 1 Replies
View Related
Oct 11, 2008
I realise this is not strictly an excel question but it forms part of my VBA code within excel
I have been writing a VBA program (with some fantastic help from you guys) part of which writes to a batch file to rename files stored in a given folder. Unfortunately this fails if the original files have spaces in the filenames. The batch file contains command lines such as: ...
View 6 Replies
View Related
Dec 17, 2009
I have been using this code to choose multiple files to manipulate:
View 3 Replies
View Related
Jan 16, 2010
What is the code to open a URL or local html file with a command button?
View 4 Replies
View Related