LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Help with XLM 4.0 Get Document command

The code below was submitted by Tom Ogilvy for getting the page breaks. It
works great, but I want to modify it to work on a set of sheets or just
replace "sheet1" with a variable name, so I can loop through various sheets.
I don't know how to modify the following xlm 4.0 macro command:
ThisWorkbook.Names.Add Name:="vPB", _
RefersToR1C1:="=GET.DOCUMENT(65,""Sheet1"")"
so I can either use a variable in place of sheet1 so I can use this on
different sheets without having to set up a separate macro for each sheet.

Thanks


Sub PageBottomBorder()
Dim horzpbArray(), i As Integer, j As Integer
Dim verpbArray()
Dim mySheet As Object
Set mySheet = ActiveSheet
With mySheet.Range("wts_border_range").Borders(xlEdgeBo ttom)
.LineStyle = xlLineStyleNone
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With

ThisWorkbook.Names.Add Name:="hzPB", _
RefersToR1C1:="=GET.DOCUMENT(64,""Sheet1"")"
ThisWorkbook.Names.Add Name:="vPB", _
RefersToR1C1:="=GET.DOCUMENT(65,""Sheet1"")"
i = 1
While Not IsError(Evaluate("Index(hzPB," & i & ")"))
ReDim Preserve horzpbArray(1 To i)
horzpbArray(i) = Evaluate("Index(hzPB," & i & ")")
With ActiveSheet.Rows(horzpbArray(i) - 1).Borders(xlEdgeBottom)
.LineStyle = xlContinuous
.Weight = xlMedium
.ColorIndex = xlAutomatic
End With
i = i + 1
Wend
ReDim Preserve horzpbArray(1 To i - 1)
Debug.Print "Horizontal Pagebreaks (rows):"
For j = LBound(horzpbArray, 1) To UBound(horzpbArray, 1)
Debug.Print j, horzpbArray(j)
Next j


i = 1
While Not IsError(Evaluate("Index(vPB," & i & ")"))
ReDim Preserve verpbArray(1 To i)
verpbArray(i) = Evaluate("Index(vPB," & i & ")")
i = i + 1
Wend
'ReDim Preserve verpbArray(1 To i - 1)
' Debug.Print "Vertical Pagebreaks (columns):"
' For j = LBound(verpbArray, 1) To UBound(verpbArray, 1)
' Debug.Print j, verpbArray(j)
' Next j
End Sub



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
command button a word document in excel Krishnakanth Excel Worksheet Functions 2 April 11th 08 03:31 PM
corrupt document and open and repair command chipsoly83 Excel Discussion (Misc queries) 2 August 21st 06 12:16 PM
How to create a formatted 'readable' document based on Excel document? [email protected] Excel Discussion (Misc queries) 0 June 23rd 06 06:09 PM
Command button to get a Word document Alex Martinez Excel Programming 3 August 21st 05 12:50 PM
command line script for printing MS Excel 2000 document. Mitso Excel Programming 1 September 8th 03 09:07 PM


All times are GMT +1. The time now is 07:25 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"