Searching XML File - Get Error Number 9?
Dec 11, 2013
The sub i'm currently using does an instr search for a unique string in an xml file. This works fine but i'd like to speed up the search if possible because I have a large number of xml files to search. My problem is that i have very little experience in parsing xml.
I notice that if i load the xml file and look at the namespaces i see item(1) through about item(20) and the unique string is always contained in one of those items. Note that the number of items can be different for each xml file i load.
The xml file is loaded into an object i define as oInstance and i'd like to do something like:
Do
counter = counter+1
if oInstance.namespaces.item(counter) = uniquestring then[code]....
but now i get Err.Number 91
View 9 Replies
ADVERTISEMENT
Feb 25, 2014
I have got a UserForm to search data from worksheet and show it in userform.
In my search userform, the data is searched by first selecting " Year " and then " Batch Number " (Two Batches runs in a Year) so I filled combo boxes with "Batch 1" and "Batch 2"
for example "Year 2013 " would have "Batch 1 and Batch 2"
"Year 2014" would have "Batch 1 and Batch 2"
In my worksheet, it has Data for "Year 2013" and data for "Year 2014" has not yet been inserted.
The Problem is that when In the Userform I select " Year 2013 " and select Batch 1 or 2 it shows data in list box and in textboxes.
But when I select "Year 2014" and select "Batch 1" or "Batch 2" it gives error. I know there is no data for "Year 2014" yet in the worksheet, but I want it should not give error in vba coding, But It should display MsgBox "No record found"
I have attached worksheet and userform. Book A1 (1).xlsm‎
View 1 Replies
View Related
Jun 15, 2007
The Code below searches for a file and displays how many files by that name it found.
Sub Test()
With Application.FileSearch
.NewSearch
.LookIn = "C:"
.SearchSubFolders = True
.Filename = "Temp.txt"
If .Execute > 0 Then
MsgBox ("Success: " & .FoundFiles.Count)
Else
MsgBox ("Fail")
End If
End With
End Sub
However, Flashdrives are a common use among those that will use the code, such that I need the code to not only search the hard drive C: but all hard drives and flash drives. Using .Lookin = My Computer did not find the files stored on my Flash Drive.
It finds it using .Lookin = "K:" but I can not rely on my flash drive always being K:. It does not find it using .Lookin = "PumaFlash" (Name of flash drive)
I'm looking for one of two things: Code that will Search all hard drives and flash drives (optical drives can be included) at once Code that will Find path for all hard drives and Flash drives and then search them separately
View 2 Replies
View Related
Nov 26, 2008
I have a number of project files that are maintained on the network.
These files are named "XXXXXX Project Name.XLS".
XXXXXX is the project number. This numbers are unique, so there is only one file per number within the directory. Project names are mostly unique, but sometimes they could be same for a specific site.
We recieve financial data in excel file format from home office. These reports reference only the project numbers, not the name.
I have created an excel program that extracts project numbers and related financial data from the report [from home office].
I would like to create a button or check box next to each project number in my program and link it to the respective file on our network. Once I access the local file on the network I could copy the financial data in its right place.
The problem is opening the file based on project number only, while the file names contain Project Name as well.
So, can I look up a file by only searching for first six characters of the name?
Or can the Hyperlink function work with some sort of wildcard? I can write the formulas to create the hyperlink and then write a macro to look for that file, but I need to be able to find and open the file by looking up only the first six characters.
View 9 Replies
View Related
Jul 14, 2009
I have been asked to fix a macro that is supposed to search column B and find any cells ending with .mov. Any row fitting the criteria is to be copied to Sheet2. The file is a internet traffic log and we are trying to determine the number of downloads we have on our video files, which are all .mov format. Sheet1 can exceed 3000 rows.
Here's what I have so far:
View 2 Replies
View Related
Sep 12, 2006
I wrote some code which has compiled a LOT of text files telling me what computers have licence for certain software.
The name of the txt file is the computer name and data within is simple:
--------------------
Audit of GQL license
Audit of Visio license
Audit of Frontpage license
Audit of Project license
Audit of Visual .NET license
Audit of Word (Office) licenses
Found Office
--------------------
as we can see here this computer has 1 licence for OFFICE.
If the string "FOUND" is found then i want to be able to paste the licence name in a spreadsheet and in the next cell underneath paste the filename it was found in the e.g.
VISIO
comp1,comp2,comp3,comp4
WORD
Comp2, comp3, comp4, comp5....and so on......
View 9 Replies
View Related
Jun 5, 2009
is it possible to type a document name in a cell,then run a code that searches a root dir and sub folders, find the existing document and open it?? for example
cell: "D20"
filename: DYAZES-001
root dir: "I:IsolationDataBaseIsolationProcedures
subfolders: DryMillA, DryMillB, Despatch, Maintenance
View 5 Replies
View Related
May 6, 2009
I read in a txt file with the code below. There's some kind of special character in the last 3 lines of the input file that makes the macro crash. I don't need anything in those 3 rows. How can I delete them before my Do Until loop?
-----
Sub Mytxt()
Dim Mytxt As String
Mytxt = Application.GetOpenFilename(FileFilter:="EXCEL files (*.txt),*.txt", Title:="Open the Report file you need")
If Mytxt = "" Then Exit Sub
Workbooks.Open Filename:=Mytxt
Open Mytxt For Input As #1
i = 1
Do Until (EOF(1) = True)
Line Input #1, tempstr
Cells(i, 1) = Mid(tempstr, 23, 5)
Cells(i, 2) = Mid(tempstr, 25, 1)
Cells(i, 3) = Mid(tempstr, 33, 3)
i = i + 1
Loop
Close 1
End Sub
View 9 Replies
View Related
Aug 21, 2013
I am trying to write a formula that will search an array for a particular number that I type in, and return a "Warning" if the number is within the array, or an "OK" if the number is not yet used. It is to do with allocating batch numbers to Raw Materials and avoiding using duplicate numbers.
View 9 Replies
View Related
Oct 11, 2013
I am trying to write a macro to open a specific file, but need to search multiple folders within folders to find it.
The file name I need to open is "Escalation Adherence-Details " & Format(Date, "mm-dd-yy") & ".xlsx".
I need to drill down to the Adherence Report folder and then have the macro search through folders for each year (2012, 2013, 2014, 2015, etc) and then each month within each year (1 January, 2 February, 3 March, etc), at which point I would then find that day's file.
So far I have the following:
Code:
Sub Open_ESCL_Report()
Workbooks.Open Filename:=*****.****.****.******.comsharesPurchasingTeam XEscalationAdherence Report & "Escalation Adherence-Details " & Format(Date, "mm-dd-yy") & ".xlsx"
End Sub
Each file is stored in it's respective month folder as .....Adherence Report(Year)(Month)(File).xlsx
View 3 Replies
View Related
Oct 14, 2013
I'm trying to search a column that has cells with various length strings. Included in the strange (at random locations) could be possibly be a 7 digit number starting with 4. I want a formula that counts the number of cells with contain that 7 digit number. Is this possible?
View 11 Replies
View Related
Jun 2, 2009
I have a list of customers and account numbers contained within a cell. I need a formula if possible that searches from the right of the cell and then returns the all the numbers. e.g.
Arsenal1234Required formula result 1234
Liverpool2456Required formula result2456
Chelsea100564Required formula result100564
I can not use text to columns as they data is not consistant. Also worth noting is that the customer numbers vary fro 1 digit to 9 digits long.
View 5 Replies
View Related
Jul 22, 2014
write a macro that search first Row and if its finds the word "Date" then the whole column should select and change the Number formatting to Date, and if it finds the word "Time" it should change the formatting for the whole column to Time.
Below is the format of Table where it should change the formatting of Date, Start Time and End Time.
Date
OrderNumber
Start Time
Status
[Code].....
View 2 Replies
View Related
Apr 3, 2008
Due to the company that i work for doing alot of manuafacturing each and every day, i need some sort of look up.
For example, the currently excel sheet i use.
[IMG][/IMG]
As you can see i have many different Job Numbers that i use.... BUT
The problem that i am facing is, that these jobs sometimes are carried over to more than one day, [sheet bottom of screenshot] but also we might make the job one day and and then not again untill next week using the same Job Number.
What I Need
I need a way of searching for a job number across all 31 days and for it to total up the "Quantity (Qty)" of them all that we made upon that Job Number.
So lets say the Job Number 91294 was run on day 1 (shown in screenshot).
And it made 25.
But it then ran again 3 days later on the same Job Number 91294.
And it made 20.
I need it to be able to work that out the total for me across them days being 45 upon the Job Number 91294.
Things to Consider
The layout will NOT change, no extra rows or coloums will be added.
View 9 Replies
View Related
Dec 4, 2013
I have a table of data that I need to find the leftmost and rightmost number in that are greater than a specified number in another cell. I've attached a spreadsheet to show what I've got to work with.
I need to do this 1 row at a time and have the outcome in descending cells on the right hand side of the 2 example rows.
View 7 Replies
View Related
Mar 1, 2012
How I can find instances of text strings containing two colon characters separated by any two (arbitrary) characters?
So in other words, "xxxx:xx:xxxx"
If I use :
Code:
SheetName.Cells.Find(What:=":**:", After:=[A1], SearchOrder:=xlByRows, SearchDirection:=xlPrevious)
...I get a return of any strings containing two colon characters (regardless of the number of characters in-between) - because obviously the asterisk(s) denote any text whatsoever.
How do I specify a finite and exact number of characters between the colons when searching?
View 3 Replies
View Related
Apr 28, 2006
on one sheet we have a summary of the main list, which includes totals of money recieved, totals of all the different sources (ie, where they heard about us from), the totals of the frequencies they pay (ie, how many donate monthly, quarterly...) ... etc. on the next sheet we have the "main" list of donors, their IDs, amounts, frequency, source ...
the totals on the first sheet are updated manually, but i want to change that as there are a great number of errors.
View 8 Replies
View Related
Dec 19, 2006
the spreadsheet needs to be copied to a directory called "C:downloads" as it contains a ODBC query to itself (In reality, this is a query to an External Oracle Database)
On loading, it should pop up a simple userform, with a combo and two command buttons, which when pressed takes you to a (hidden) tab that displays a pivottable.
All works well until I try to close /save when 60% of the time, Excel encounters problems and closes and will not load up the file the next time until either quit excel or disable macros. Messages include "file/path access error", "I/O Error" or get restarts excel.
On a casual run through, I expect you might report back that "All worked ok for me". Please can you give it a bit of a thrashing, comment out the userform show, save the file (frequently) becuase i assure you it will break ultimately!
This is a brand-new file and I've tried it on about 5 different PC running different versions of Excel and generally get the same result.
View 7 Replies
View Related
Mar 7, 2012
I am receiving an error at
Set CopyRng = Wkb.worksheet1.Range(Cells(RowofCopyworksheet, 1),
Cells(Cells(Rows.Count, 1).End(xlUp).Row, Cells(1, Columns.Count).End(xlToLeft).Column))
I am trying to copy the first sheet in each file in the designated folder and paste it into a master worksheet.
Below is the code.
'Description: Combines all files in a specific folder to Format File for Upload.xls
Sub MergeMultipleFiles()
Dim path As String, ThisWB As String, lngFilecounter As Long
Dim wbDest As Workbook, shtDest As Worksheet, ws As Worksheet
Dim filename As String, Wkb As Workbook
Dim CopyRng As Range, Dest As Range
Dim RowofCopySheet As Integer
[Code] ....
View 1 Replies
View Related
Feb 2, 2007
When it opens the desired file, it increments the file name by 1 each time it is opened (via the macro).
Example;
The first time it is opened you see the file name in the header read "P'Binder L&T Pages" for a moment, then it changes to "P'Binder L&T Pages1"...
I close the file and open it again (via the macro), and see the file name in the header read "P'Binder L&T Pages" for a moment, then it changes to "P'Binder L&T Pages2"...
The file name continues to increment on every opening until the PC is rebooted, then it starts at 1 again.
Sub OpnLTpages()
Dim wb As Workbook
Dim AlreadyOpen As Boolean
AlreadyOpen = False
For Each wb In Workbooks 'Scan open workbooks
If wb.Name = "P'Binder L&T Pages.xls" Then ........................
View 9 Replies
View Related
Jan 29, 2014
I have a file that I save with a new version number each time I make major changes. The file name currently is: "Telephony Equipment Inventory v26 (Summary).xlsm". The "26" is the variable number. give me the vba code to ensure I open the file with the highest version number?
View 6 Replies
View Related
Jul 31, 2014
I have an excel database where I register cases. I have in it a button that creates a folder with and ID nr that is in column A (I create new ID nr in the next row, when I press the button it will create a folder with that ID nr and inserts a blank word document in it). We have a template that we copy to the folder (depending what type of case). The idea would be that once the template is filled in and ready to print, It would take the values from the ID nr and a reference number a few cells to the right. Is it possible to tell excel to open the word document in the folder and create a PDF version with the ID nr and reference number. (there are only 2 templates, so the macro would have to look for one of the two in the folder) The names of the templates are: "Standard" and "Other". I guess the best way to start maybe this would be that I select the cell with the ID nr and then press a macro button to have this done. One thing that needs to be done, is to put a copy in the same folder and another in a second folder called "Binder" in my documents folder.
View 1 Replies
View Related
Jul 10, 2009
In order to get inventory data from our Incode database, I've been creating an output file with the extension .IRP Thinking that excel would not bring in this data from the .IRP file directly, I would then create a txt file of it with notepad. I've recently discovered that I can bring it in directly from the .IRP
The file being created is in this format:
IN Stock Status Report - 6385.IRP
The number portion, 6385 in the name will vary everytime I generate a new report. However the text portion will not.
Currently, I've recorded a macro the bring in the data to my excel spreadsheet.
But it will only bring in data for the set filename.
View 13 Replies
View Related
Jul 9, 2013
I created a macro to run with my daily reports in excel. The only issue is the names of the report change every day respectively as Mat1 mm-dd-yy. I have tried to manover with the code but it always leads to a dead end. How can I change the code to be able to run with any date.
Mat1Macro Macro
'
'
Columns("A:A").Select
Selection.Delete Shift:=xlToLeft
Rows("1:4").Select
Range("A4").Activate
Selection.Delete Shift:=xlUp
Range("C1").Select
Range(Selection, ActiveCell.SpecialCells(xlLastCell)).Select
Selection.EntireColumn.Delete
[code]....
View 3 Replies
View Related
Dec 14, 2009
I have some very important excel spreads that are returning this error...
"The file might have been damaged or modified from its original format."
Out of the blue. Google search step-by-steps keep saying I need to "Open and Repair", but I can't find this function anywhere on the Mac osx version I have, and Help doesn't return any info either.
How do I repair these files? I have not updated my Excel version, nor have I updated my operating system. Indeed, I have done nothing unusual with these files at all, this is totally sudden.
View 11 Replies
View Related
Dec 17, 2009
The error that pops up has no information other than "File not found" in a dialog box with two buttons.
File not found (Error 53)
The file was not found where specified. This error has the following causes and solutions:
A statement, for example, Kill, Name, or Open, refers to a file that doesn't exist.
Check the spelling of the file name and the path specification.
An attempt has been made to call a procedure in a dynamic-link library (DLL) or Macintosh code resource, but the library or resource file name specified in the Lib clause of the Declare statement can't be found.
Check the spelling of the file name and the path specification.
In the development environment, this error occurs if you attempt to open a project or load a text file that doesn't exist.
Check the spelling of the project name or file name and the path specification.
For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).
View 3 Replies
View Related
Nov 19, 2009
We have built quite a large Excel based program that contains quite a lot of coding. the program seems to work fine the majority of the time but every so often we recieve an error message that causes excel to not save, or to crash and shut down.
The message that comes up is "File/Path Error"
Now I've just done some hunting around online and some links I have found speak of declairing the document location correctly in the coding. I was wondering could this be the issue at hand?
Anytime the document needs to save, there is a cell with the directory path and file path declared as a variable (Actually as Dim String) within the coding. Is this the best way to declare a file path?
Also, the problem seems intermittent. We Compile the VBA coding before saving, we also use a Clean Project add-in within Excel. These processes usually help but every so often the problem comes back.
View 9 Replies
View Related
Nov 6, 2006
I am trying to open an Add-In file (that I wrote) and I am now getting the following error "File Not Found". I am sure it has to do with a typo in the code or something.
However, I cannot get anything to open up so that I can see the VBA code. The spreadsheet itself does not contain any data, just the VBA project.
how I can get at the code to fix it?
I tried to upload the file, but it is too big for the requirements.
View 9 Replies
View Related
Apr 3, 2014
I am facing a weird date format error in .csv file for a specific time periods.
I have a file where data is stored on monthly basis from the years 1976 uptil today. I have all the data months in expected format except for the years 1989, 1990 and 1991. These files are created by using Informatica and SAS.
For example:
Expected date format = 1-January 1989
Actual Date Format = 1-Jan-89
This issue doesn't exist when we open the same file in Excel, Textpad and Notepad.
I have attached screenshot of the data (filename: CSV Issue.JPG).
View 7 Replies
View Related
Dec 18, 2008
Anyone ever seen this error “File not found: VBA6.DLL” ?
This error happens when I press a button I’ve created in the sheet. Funny thing is that there are other buttons right beside this button and they all work just fine. I’ve checked the code and names of all the macros in the sheet.
I’ve recreated a different module and renamed the macro and attached the code to another button.
View 3 Replies
View Related