|
-
May 2nd, 2006, 02:40 PM
#1
Thread Starter
New Member
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.
Last edited by rkidd; May 2nd, 2006 at 02:52 PM.
-
May 2nd, 2006, 05:11 PM
#2
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.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|