Microsoft Office Tutorials and References
In Depth Information
Changing the Path for Graphics Files
ByVal Offset As Long) As Long¶
'iNr is declared as type "Variant" because¶
'it can contain numbers as well as strings¶
'Variable declaration¶
Dim iNr As Variant¶
Do¶
Offset = Offset + 1¶
iNr = iNr & Mid(sString, Offset, 1)¶
Loop While IsNumeric(iNr)¶
ExtractNumber = Left(iNr, Len(iNr) - 1)¶
End Function¶
' * * * * *¶
Sub MoveGraphicViaClipboard(shp As Word.Shape, _¶
PageNr As Long)¶
'Variable declaration¶
Dim rngPage As Word.Range¶
Dim rngPageStart As Word.Range¶
Dim vw As Word.View¶
Dim lViewType As Long¶
Dim bWholePage As Boolean¶
'Graphics can only be moved in the¶
'Print Layout view. Save the user's¶
'current view and restore it when done¶
Set vw = shp.Parent.ActiveWindow.View¶
lViewType = vw.Type¶
vw.Type = wdPrintView¶
'Turn off hidden text as that will¶
'falsify page numbers¶
vw.ShowHiddenText = False¶
If Val(Application.Version) >= 10 Then¶
'Graphics will be positioned incorrectly¶
'if the target range is not in view¶
'In Word 2002 and 2003 be sure to¶
'display the top and bottom margins!¶
bWholePage = vw.DisplayPageBoundaries¶
vw.DisplayPageBoundaries = True¶
End If¶
'Put the graphic on the clipboard¶
shp.Select¶
Selection.Cut¶
'Go to the required page¶
Selection.GoTo What:=wdGoToPage, _¶
Which:=wdGoToAbsolute, _¶
Count:=PageNr¶
Set rngPage = ActiveDocument.Bookmarks("\Page").Range¶
'If the target page is the last page of the document¶
'make sure to include the last paragraph mark¶
If rngPage.Information(wdActiveEndPageNumber) = _¶
rngPage.Information(wdNumberOfPagesInDocument) Then _¶
rngPage.MoveEnd wdParagraph, 1¶
Set rngPageStart = rngPage.Duplicate¶
Wrd
Search JabSto ::




Custom Search