Changes the Application object to a relative object rather than an absolute object. For more information on absolute and relative URLs, refer to Understanding Absolute and Relative URL Addressing
expression.MakeRel(UrlBase, Url)
expression An expression that returns an Application object.
UrlBase Required Variant. A base URL. Can be one of the following, a string, or an object of type WebEx, WebFolder, WebFile, NavvigationNode, or IHTMLDocuemnt2.
Url Required String. A string that contains the entire URL. This can be any URL for a web, such as http://web server/folder or file://file system/folder for disk-based webs.
This example changes an absolute URL to a relative URL, adds a hyperlink to the active document using the relative URL, and then saves the changes to the active page window.
Note To run this example, you must have a web called "C:\My Documents\My Webs\Rogue Cellars" (for a server running on Microsoft Windows) or "C:\WINNT\Profiles\logon alias\Personal\My Webs\Rogue Cellars" (for a server running on Windows NT). You must also have two files, one called "Zinfandel.htm" and the other called "index.htm", which has an absolute URL (the default state). Or, you may substitute an alternative web URL and substitute alternative file names.
Private Sub MakeURLRelative()
Dim myFile As WebFile
Dim myFile2 As WebFile
Dim myBaseURL As WebEx
Dim myDoc As FPHTMLDocument
Dim myRelAddress As String
Dim myRelAddress2 As String
Set myBaseURL = Webs.Open("C:\My Documents\My Webs\Rogue Cellars")
Set myFile = myBaseURL.RootFolder.Files("Zinfandel.htm")
Set myFile2 = myBaseURL.RootFolder.Files("index.htm")
Set myDoc = myFile.Edit(fpPageViewNormal).Document
myRelAddress = MakeRel(myBaseURL, myFile2.Url)
myRelAddress2 = """" & myRelAddress & """"
Call myDoc.body.insertAdjacentHTML("BeforeEnd", "<a href=" _
& myRelAddress2 & ">" & myRelAddress & "</a>")
ActivePageWindow.Save
End Sub