Hi,
I have written this procedure that converts decimal time (1.75) into analogue time (1hr 45 mins). It works ok, but seems a little verbose. Any suggestions for making it more efficient and shorter?
Regards,
Sub testString()
Dim Duration As String
Dim hrs As String, mins As String, totTime...
Hi Gerry,
Thanks for coming back. Understand about using ranges now, but not sure if it would help regarding part of the search requirement (the two column data). See the attached spreadsheet and this may give you a better idea of what I was after in the first place. As I said though, thanks to...
Fumei you are a star!
The code works exactly as i want it to. I have tried it on a document with over 4000 rows and it took around 20 minutes. Slow admittedly, but does the job.
My perception is that the multiple tables are much easier to reference and quicker to search.
I can now use this...
Guys,
Thanks for the input. Bong,
I have tried your code and with my limited expertise have put together the code below.
Text is found a range is set(not sure how accurate it is) and text is returned. Unfortunately, it only returns the first complete header row of the table and not the two...
Hi Guys,
Tried your code Bong and it returns the Blank row indexes, so tried the code below:
If Selection.Find.Found = True Then
Selection.Select
Selection.MoveLeft wdCell, 1, wdMove
Selection.Select...
Hi Geoff,
Comforting to know that you are still there.
Excel plays a part in this process as it stands now. The BO report is opened in Excel and the user manually selects the cells to be input into the word document. Through the process of formatting the document, the users selection is pasted...
Hi Bong,
i have just tried the code on a large document with little success. I hasten to add that this isn't due to your code, just the sheer size of the document. The document is some 450 pages long with over 2000 rows which could potentially result in 100+ individual tables. Unfortunately...
Hi Bong,
Thanks for the prompt reply. Changed the code to that shown below. There is a different error now:
RunTime Error 4120
Bad parameter
The offending line is newTable.Split (i)
Sorry to be a pain, but i am new to VBA and still learning.
Dim eRow as Row
Dim newTable as Table
Dim i as...
Hi Bong,
Thanks for correcting the code. Works great. The code splits the table into multiple tables. The only thing is that an error is generated at the end of the procedure:
RunTime Error 5
Invalid procedure call or argument
Dim eRow as Row
Dim newTable as Table
Dim i as Long
Set newTable...
Hi Bong,
Hope you had a great weekend.
Been tinkering with your code on a document and it seems to go into an infinite loop.
I have used my own variables as follows:
Dim eRow as Row
Dim newTable as Table
Dim i as Long
Set newTable = ActiveDocument.Tables(1)
i = 1
Do While i > 0...
Hi Geoff,
Excel may be the better option from a speed point of view, but the document that I am working in is a Word document. So I am finding text in a data range, if the search meets the criteria, the found text is assigned to a table in the main document. With a word table, I can search for...
Hi Everyone,
I have a .txt file that has been exported from Business Objects. I am formatting the file as a word document and then converting the text to a table. The resulting table can be in excess of 2000 rows. Each range of data within the table is separated by a blank row. I want to split...
Hi Everyone,
I revisited this problem with opening a document from the closing document and have found a solution. Quite simple really: Set the opening document UserForm to Modaless. Focus is maintained in the Closing document and passes to the opening document when the routine in the closing...
I can only concur with WalkerEvans, because i too have been up said defacation inlet without means of propulsion as well. It has only been through the dedication of Fumei, yourself WalkerEvans and others that have helped me out. It is also a learning curve for me and hopefully, when I feel...
Know the problem!
Just one thing I noticed last night...
When removing the end of cell marker etc:
PS1=Left(PS1, Len(PS1)-2)
PS2=Left(PS2, Len(PS2)-2)
PS1 does just that, removes the end of cell marker and paragraph mark.
However, PS2 removes the last two characters of the found text.
I...
Hi WalkerEvans,
Just had 5 minutes to tinker with your code. Couldn't try it on the document that the code will be working on because i am not back in the office until Thursday, but it works great!
Some Microsoft related sites recommend creating tables from text rather than assigning text...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.