Need help with syntax with a quick Macro
I have a 154 page document that requires me to edit each line to a specific format. I need to change lines like this:
scielo.isciii.es/scielo.php/script_sci_serial/pid_1139-1375/lng_en/nrm_iso
www.scielo.br/ag
www.zoosystema.com
http://www.scielo.br/scielo.php/scri...lng_en/nrm_iso
www.ijnephrol.com/index2.htm
jcom.sissa.it/
to this:
scielo.isciii.es
www.scielo.br
www.zoosystema.com
www.scielo.br
www.ijnephrol.com
jcom.sissa.it
Now the research I've done so far has led me to this (please forgive me I'm a java programmer and without a reference book I'm lost):
VB Code:
For Each element In collection
' determine the column the first / occurs and save into a variable
' delete all characters from variable to end of the line
Next element
now I know a few things:
-I need element to be each line/paragraph of the document. I say line because each URL encompasses one line. But I also say paragraph because there is a carriage return at the end of each line.
-I know collection should be the full document but I'm not sure how.
-I have no idea how to determine what column a specific character occurs
-I have no idea how to delete characters
That said I've tried MSDN and that is the worst means to find information I've ever seen. Hate it.
Any help would be greatly appreciated.
Re: Need help with syntax with a quick Macro
Welcome to the Forums.
Sounds like your using a Word document?
If so there is a Hyperlinks collection that you would use in the format you posted.
VB Code:
Dim hyp As Word.Hyperlink
For Each hyp In ActiveDocument.Hyperlinks
MsgBox hyp.Address
Next
Now you can write the hyperlink url out to a file or whatever instead of the example MsgBox. You can change the link or the display text or ? you need to do.