ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Changing Hyperlinks? (https://www.excelbanter.com/excel-discussion-misc-queries/21991-changing-hyperlinks.html)

Madvikefan

Changing Hyperlinks?
 
Ok, I have a problem...
When I begin to change 312 some hyperlinks in a worksheet
By starting out with:
Fix Hyperlinks (#FixHyperlinks)
Sub FixscannedHyperlinks()
Dim OldStr As String, NewStr As String
OldStr="S:\users\Z011528\matt p\scanned dwgs\"
NewStr="S:\Sundata\cad\maintenance\scanned dwgs\"
Dim hyp As Hyperlink
For Each hyp In Activesheet.Hyperlinks
hyp.Address=Replace(hyp.Address, OldStr, NewStr)
Next hyp
End Sub

Excel Prompts me with a "compile error" "expected indentifier"
and the first line:
Fix Hyperlinks (#FixHyperlinks) is highlighted in red!

Whats wrong??


bj

I assume (shudder) that the "Fix Hyperlinks (#FixHyperlinks)" line is a comment
insert a hyphen in front of it and retry. If it is not a comment, What is it
for?


"Madvikefan" wrote:

Ok, I have a problem...
When I begin to change 312 some hyperlinks in a worksheet
By starting out with:
Fix Hyperlinks (#FixHyperlinks)
Sub FixscannedHyperlinks()
Dim OldStr As String, NewStr As String
OldStr="S:\users\Z011528\matt p\scanned dwgs\"
NewStr="S:\Sundata\cad\maintenance\scanned dwgs\"
Dim hyp As Hyperlink
For Each hyp In Activesheet.Hyperlinks
hyp.Address=Replace(hyp.Address, OldStr, NewStr)
Next hyp
End Sub

Excel Prompts me with a "compile error" "expected indentifier"
and the first line:
Fix Hyperlinks (#FixHyperlinks) is highlighted in red!

Whats wrong??


AlfD

Hi!

It should be red!

I take it it is meant to be a title or comment, in which case, put a '
in front of it.

Alf



All times are GMT +1. The time now is 12:52 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com