This example demonstrates how to replace a single page in a file.
Private Sub cmdReplace_Click()
Dim strOrigFile, strReplaceFile As String
Dim lngPgCount As Long
'Use the dialog box to pick the original file.
ImgAdmin1.DialogTitle = "Select the original file"
ImgAdmin1.ShowFileDialog OpenDlg
'Because we are using the dialog box to pick the file to
'be used for replace, we need to save the original file.
strOrigFile = ImgAdmin1.Image
ImgAdmin1.DialogTitle = "Select the file to be used
for the replace"
ImgAdmin1.ShowFileDialog OpenDlg
strReplaceFile = ImgAdmin1.Image
'Restore the original filename to the Image property because
'the property must contain the destination file name.
ImgAdmin1.Image = strOrigFile
'You are going to replace 1 page page 4 in
'original file will be replaced by page 2 of the source file.
'The compression type of the source file will be retained
'since a different compression type is not specified.
ImgAdmin1.Replace strReplaceFile, 2, 4, 1
End Sub