Search For File With Wildcards And Partial Filename

Nov 21, 2008

I am trying to set a file name as a string to use it as an attachment. The user inputs a number into a textbox. That number is used to locate the file in location. But the file name is different with each file. So im trying to do something like

"C:Desktop*TextBox1*.docx"

Whereas the actual file name is "C:DesktopMCJC RFI 1 MISSING ROOM NUMBERS.docx"

The location "C:Desktop" will always remain the same as will ".docx". I have everything else working just fine.

View 8 Replies


ADVERTISEMENT

Copy A File By Specifying A Partial Filename

Oct 7, 2008

I'm attempting to copy some files into an archive folder in the same main folder. These files appear weekly in a folder that contains numerous other files.

Each of these files has a filename such as:

RAH_MRL_TOP_40_(ddmmyy_TIME)

with time being the time that the report was run.

Every week the filename stays the same but the time and date changes. I was hoping to be able to simply use the "Filecopy" command and specify the source file with a "*" after the main file name. However this does not seem to work.

Is there a simple way to do this? (I dont want more than a few lines of coding really as I will be duplicating it for each file and then changing the file name as needed.

View 9 Replies View Related

GetOpenFilename Partial Filename Filter

Jun 18, 2006

I am using the GetOpenFilename method to allow the user to select a file to open:

vaFiler = Application.GetOpenFilename _
(FileFilter:="Adobe PDF Files (*.pdf),*.pdf", _
title:=Description, MultiSelect:=False)

What I would like to do is 'pre-load' the filename the user can select. They will be picking a file to attach to a part as a datasheet. Almost every single datasheet in the library has the part nuber as part of it's filename, so to make it a little quicker (and more accurate), I want pre-load the filename selection window with *partnr*.pdf. If nothing shows up, the user can delete filename I have entered for them and see all files in that directory.

View 3 Replies View Related

Attach Files To Email Based On Partial Filename?

Jul 31, 2014

I'm currently creating E-mails containing a table of material numbers in the body of the message. The E-mail is generated with a macro from a table in excel. In some folder - say on the desktop - I have PDF files for each material Number. Each file is called 0012345_Product-Name.pdf where 0012345 is the material number (always 7 digits). I want the macro to look for the pdf for each material number found in the table and add it to the E-mail as an attachment. With constant, known file names this wouldn't be much of an issue. However, I'm having trouble getting the macro to only search for the first 7 digits of the filename and select it based on that.

Since we are talking up to several 100 PDF's, it would also be great to zip them, once selected - if at all possible, before attaching them to the E-mail

View 2 Replies View Related

Using Wildcards With Search Formula?

Jan 17, 2013

I'm trying to use wildcards in the Search formula and it isn't working the way I thought it would. I'm trying to use the following two strings:

????1234

compared to

1234????

Shouldn't search find these two strings the same since given the wildcards? Or am I missing something? If I use the above, I receive a VALUE error rather than a match.

View 9 Replies View Related

Lookup With Wildcards In The Middle Of Search Term

Feb 5, 2014

I have a 14 000-item list of product codes that are generated from different attributes. What I am trying to do, is to create a cover sheet where the user can select attributes from dropdown lists and get the first matching product code. I have tried using index/match, but I am struggling with wildcard lookup.

Example of generated product code:Cell A1:
ABX**J

Here, AB is the product group, X is the pressure class, ** is material (which is, for the example, unknown), and J is the end connection. What I now want to do, is to look in the long list of codes and find the first match:

Cells A2:A5:AAY02J
ABY03F
ABX01J

View 1 Replies View Related

Wildcards In File/Workbook Open

Aug 17, 2006

Is it possible to find/open a workbook if we know its name partially.I mean just like that.

Sub Open_WB
Dim wb As workbook
Set wb = workbooks.open("D:*xyz*.xls")
End Sub

View 2 Replies View Related

Look Up With Partial Text Search

Apr 16, 2009

I am looking for a lookup to look for text within Column A that matches text in column D and brings the word in that is in column E ...

View 9 Replies View Related

Partial Word Search

Jul 25, 2006

Is there a command out there that i can use to search a cell or textbox for part of a word, eg. my word being phone, and for it to look at cellphone and recognize it.

View 4 Replies View Related

Moving Columns Of Data Into Another File And Saving File With New Filename?

Aug 30, 2013

I was wondering if there is a way to write a macro that will take an excel file that I have called Alldata and then have it copy the first two sheets to a new workbook named something else( FullSparameter_0) and then copy the name of the third and fourth sheet into the new FullSparameter_0 workbook and then copy column A-E from sheet dB Alldata.xls and paste it into the FullSparameter_0.xls workbook in the same dB sheet in the same spot. And do the same thing with the Phase Sheet. i know this sounds confusing, but im really new to the VBA stuff.

I just need 15 different files from the original Alldata.xls that will be named FullSparameter_0, FullSparameter_1, .., FullSparameter_14. but each file will have the same two first sheets, Setup Information and Cal Verification, and the same last two sheet names, dB and Phase, but then in the dB and phase sheets, it will copy over the next four columns of data. so in FullSparameter_0 it will have column A-E from sheet dB in Alldata.xls in the dB sheet in FullSparameter_0 (Same with the Phase Sheets). Then in FullSparameter_1 it will have column A and Columns F,G,H and I (for dB and Phase). In fullSparameter_2 it will have column A and then J,K,L and M. Each FullSparameter_X will have the exact same first two sheets and then the other columns for the last two sheets will be pasted into columns A-E in dB and Phase.

View 1 Replies View Related

VBA - Search Worksheet Tabs By Partial Name

Jun 29, 2011

I have a spreadsheet that is sent to me monthly. Here is the issue:

Each workbook contains multiple tabs. The position of those tabs may be different positions when received.

The part of each tab's naming convention does not change, while the rest of the tabs' name contains random information.

My question: Is it possible to to search/find the tab based on part of the name?

example: Name on tab:
Pivot Table Data June 2011

Search for: Pivot

View 3 Replies View Related

Record Filename And Creation Date Of File Used In Another File

Mar 21, 2014

I have a template file that I import data in to, which is then saved with the current date. This works, but I want to automate the import of the data, but ensure I don't duplicate the load.
Therefore, I have a tab 'FileLog' that I record the filename (variable by date) in column A and Creation timestamp in column B.

How do I obtain the filename and creation timestamp of the import data so that they can be entered?

View 11 Replies View Related

Search Partial Text With In Data Range?

Dec 18, 2013

I am trying to search partial txt with in data range.

View 4 Replies View Related

VBA Function To Search Partial String And Return Value?

Jan 28, 2014

I'm trying to come up with a VBA function that would return cell values based on another cell value.

I can do this by comparing a range (column of cells) with the cell value to match and then return the value of the cell next to it.

For instance,

The function should search a column for partial text, as follows:

TS ID
PDT ID

TS 1.1
PDT 1

TS 1.2
PDT 2

TS 1.3
PDT 3

TS 2.1
PDT 4

TS 2.2
PDT 5

TS 3.1
PDT 6

TS 3.2
PDT 7

In the above table, the function should for partial text and return string as follows:

TS covered
PDTs

TS 1.1, TS 1.2, TS 1.3
PDT 1, PDT 2, PDT 3

TS 2.1, TS 2.2
PDT 4, PDT 5

TS 3.1, TS 3.2
PDT 6, PDT 7

So basically I am searching for partial text TS 1. and so on

View 4 Replies View Related

Search Partial String, Return Value In Next Column, Vba

Feb 13, 2008

I would like to search cells in column D for the partial string, "PIPE," (A full string may look like this: 'PIPE, 24"ODx0.375"WT API-5LX-65,ERW OR SMLS'). Then, if it's there, return the value "LF" in the corresponding cell in column C. If that string isn't found, then I'd like it to return "EA".

I know this seems pretty easy, but there's a small problem. The word "BENT PIPE," could be in Column D, in which case, I would want it to return "EA" instead of "LF".

View 3 Replies View Related

Retrieve Record On Partial String Search

Feb 20, 2008

I have created a Userform for entry data's in a Excel2003 file. I would like to retrieve a complete record (= a row) by searching on a string contained in a cell of this searched record-row. Here an example of a row and I'm searching upon "2041" via an inputbox.

idn° claims Dateréf. Suppl supplier Fax n° PO
1AAA2041 2/01/08200039 BOSCH (RAS) 056/20.26.75 774634

View 9 Replies View Related

Search Variable Number Of Sheets To Find Partial Match On Name

Jun 19, 2014

I have a monthly report. Worksheets for each month, each row is a type of fruit (column A), and the number sold (column B). A new worksheet is added each month with the information. I also have a Summary worksheet - running total of all months: Type of Fruit (column A), Number sold (column B), and Total of all fruits - number sold. I would like a formula for the Summary worksheet - to match that fruit (column A) to any of the other worksheets - matching the fruit (column A), and bring back the number sold (column B). (note some apples are Fuji and some are Honey crisp - those would be totaled together)

ex:
Tab = Jan 14
Fuji apples3
Bananas2
grapes9
TOTAL14

[Code]....

View 2 Replies View Related

Userform To Search For Exact And Partial Values From Combobox In Database Worksheet

Jan 15, 2014

Below is my current code. The strFind1 searches for a name within the database and then I need strFind2 to do a exact for a Subproject search and a partial search for everything containing the Subproject selected and other Subprojects. Currently, when the database entry in the worksheet includes Subproject 1 the search function works but when I have an entry that contains Subproject 1/Subproject 4 it does not find the entry. How can I expand the strFind2 to equal what is selected in the Combobox2 and find entries that have what is selected plus more text. I have set the line where I think everything is going wrong to a bold format.

[Code] .....

View 2 Replies View Related

Partial Import From Text File

Jun 18, 2014

I have about 100 text files from which I need to import specific sets of numbers into excel. The part in the file looks like this

Mg24(MR)1917.4198.5
Mg25(MR)250.453.6
Mg26(MR)264.464.2

I need to import the numbers in the 1st row but they need to be transposed. and than of cause I need to do that for the other 99 files I have.

View 14 Replies View Related

Importing A Partial Text File

Oct 30, 2008

I have VBA code that imports a text file using a fixed width separator within the code. The code is working just as I need it to work and placing the information/data in the columns that I have specified in the code.

The issue I have is I only want to import certain data that is contained within the text file. It is going to be a little hard to explain, so I have attached a sample of the text file with dummy data to better explain. The file is broken up into different segments. Each segment is identified by a “Base Number” in column A of the text file (once it has been converted into an Excel file).

For my example, I only want to import data for Base Number 38451. The information for this segment is easy enough to identify when the data starts and when the data ends. As in this example, the first occurrence of 38451 begins at row 257. Once the first instance of this number is identified, the first row of data that I require is always two rows after.

I think the coding should go something like this, but I just can’t figure out how to put it into my
If cell in column A = 38451 then
- start importing from 2 rows down
- continue to import until next row in column C is not = date

If row in column C = blank then
- search in column A until cell = 38451

If cell in column A = 38451 then
- start importing from 1 row down
- continue to import until next row in column C is not = date

Else
- stop import

I have included two files. (1) the text file with the data (2) the Excel file. There are two tabs in the Excel file “ReconSheet” (contains the data that is imported from the text file) and “Desired Result” (this is how I want the end product to look).

View 5 Replies View Related

Open File With Date In Filename

Aug 6, 2013

I have a csv file named "BB31_2013-08-01". I would like to open this file via vba and this is not my only file. I also have another similar fileames such as "BB31_2013-08-08", therefore, I try to create some function like yyyy, mm & dd where I can modifie it easily for next file.

Here is my code:

VB:
'change weekly
yyyy = "2013"
mm = "08"
dd = "01"

Workbooks.Open Filename:= _
"C:Documents and Settings1314228DesktopTest ProgressBB31& yyyy &-& mm &-& dd.csv"

[Code] .....

View 3 Replies View Related

Corrupt File: Filename.xls Cannot Be Opened

Apr 18, 2006

I was working on a tax file yesturday, just a long long list of receipts. and the file is password protected. However, I went to open it today, and I get a message that says: "Filename.xls cannot be opened. the file may be read only, or you may be trying to access a read only location. Or, the server the file is located on may not be responding."

It's on my USB Drive. I've tried copying it to my HD so I can play with a copy, but no dice. When I try that, I get another error message, : Cannot copy Filename.xls. The file or directory is corrupted and unreadable. I've tried the various fixed suggested in the excel help files to no avail. I did a search on the forum, but didn't find anything that seemed to apply or help me. The computer I'm trying to open it on has Office 2003, the one I most recently worked on the file on has office XP. Not sure if this was a source of the problem. Doesn't seem like it should be. Hasn't been in the past. I'm not even getting to the dialogue box asking for my password yet.

View 2 Replies View Related

Dim A Filename: Pass The Name Of File To A Dimmed Value

Apr 17, 2007

I have a file (I'll call it 'Template' where I am extracting data into a new workbook. I refer back to my Template in my code, but I have now come across an issue. I will save the template using different country names, for example, if I am populating it with UK data, I will call it 'Template - UK'. In my code, how do I pass the name of this file to a dimmed value. So If i have the template - Uk open, can I pass the filename onto a dimmed value? So instead of having

Windows("template - UK").Activate

I want to have something along the lines of (although I tried this way but it didn't work):

Dim template As String
template = Application. ActiveWorkbook
Windows(template).Activate

View 8 Replies View Related

Prompt User For Directory And Filename; Then Save File In Directory With File Name

Jun 10, 2009

I am trying to prompt the user for the directory to be saved in and file name to be saved as; then save the workbook in the input directory with the inputted file name.

View 3 Replies View Related

File Save As With Added Date To Filename?

Aug 9, 2012

I want to create a macro that when executed changes the name of "File1" to "File1 - Edited 8-9-2012". With the date being today's date (variable). This file is going to be emailed to someone who will then execute this macro.

Is there a way to prompt the Save As window with the updated file name so the user can save the file where ever he/she wants?

View 9 Replies View Related

VBA Code To Generate Filename Without Actually Saving File

Jan 23, 2014

I have a file that I want to name based on content in certain cells. I.e. "Q-(text from cell G1)-(text from cell B7)-Date(mm_dd_yy)". I want to be able to specify the location where I save this file each time I try to save it, but I want it to update the file's name if any of the parameters have changed.

I have some code generated that does just about everything right except that it automatically saves a version of the file in the folder where the original is located even though it also brings up the dialog box and allows me to save it in another location.

Basically, I want to fix the code below so that it doesn't save what appears to be a backup file each time. Should I be using some sort of savecopyas?

Code:
Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
'Add the quote # to the header
ActiveSheet.PageSetup.RightHeader = "Quote No. " & Range("G1").Value

[Code].....

View 6 Replies View Related

Opening File Paths Where Filename Will Vary

Feb 4, 2014

I'm trying to write code that will open files within a specific folder. However, the end of each filename is going to vary over time to the point that I'll never be able to predict the exact filename.

Is it possible to write something like:

Code:
Set wb = Workbooks.Open "C:\folderfile_filenumberxxxx.xlsx"

Where the "xxxx" signifies the variable element of the file name that could be any four characters? Failing that, is there a similar possible alternative?

View 1 Replies View Related

Open File With Changing Filename-2007

Aug 1, 2008

I would like to create a macro to open a file in Excel 2007. My problem is that the filename changes often. After updates are made the filename is changed and the old file is moved to a backup folder. So, there is only one similar file in the folder

My filename is "RFQ Worksheet 7 29 2008.xlsx".
The path is "C:Documents and SettingsahaynijDesktop".

View 5 Replies View Related

Get Full Address Of External File By Specifying Filename And Then Evaluate

Jan 9, 2014

I'm really looking for a way to get the full address of the external file by specifying the file name in a cell and then evaluate the formula. For example,

[Code] .....

is the full address of the source file called 'Source'. My idea is: if I just type the file name 'Source' in a workbook's cell $A$1, and in cell $B$1 I want to make the formula something like:

="C:Users["&$A$1&".xlsx]Sheet1'!$F$1"

This will make my project very impressive with this feature: a user just types the file name to establish the link and evaluate the formula for results.

View 4 Replies View Related

Open File In Directory With Part Of Filename As String

Mar 11, 2014

I have a Workbook "forecast.xlsx" and several Workbooks which have a individual Number in the Filename (E.g. "3960........xls", "3961.......xls etc.) in the same directory as "forecast.xlsx" + projects"

Now, I would like to browse through "forecast.xlsx" in column H, searching for hyperlinks. In Column H are these Projectnumbers located which are used in the filenames above. Whenever the Cell cointains a hyperlink, following should happen (that far i managed it by myself):

- Store the Cellvalue in a String Variable
- Go to the Directory this.workbook + projects
- browse this folder, searching for a File which contains the stored string in its filename
- open the file
- copy a range
- close file
- This.workbook.Activate
- follow the Hyperlink which has been stored as String before
- paste selection
- continue browsing through column H, looking for the next hyperlink.

I have a VBA which runs bugless, but it copies the wrong range, but to the correct destination.

See the code below:

Sub RESLT_INPUT_ALL()
Dim cell As Object
For Counter = 1 To 1000
Set cell = Worksheets("Projects overview").Cells(Counter, 8)
If cell.Hyperlinks.Count > 0 Then

[Code] ......

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved