Jump to content

Psyclist

Members
  • Posts

    4
  • Joined

  • Last visited

Everything posted by Psyclist

  1. Steve, your code works for me too. I'm thinking that because I SELECT the shape in order to set a few properties, this causes the macro to behave differently in some way. I still don't get why it still doesn't work when I deselect the shape and select the paragraph mark in the header.
  2. In looking at this again, I'm noticing something that might be a clue. When the shape is created and thus "selected", the header window or pane (not sure what to call it) is not open but the shape is clearly selected. The same is true when I select the paragraph mark in the header - it's clearly selected but the header window/pane is not open - it looks as the though I'm in the main document but the selection is clearly not. By saying that the header/footer window or pane is not open, I mean that those "Header" and "Footer" upside down shaded tabs are not visible (if you double click on a document's header or footer the header/footer pane will open and these tabs appear).
  3. Hi Steve, thank you for responding. I'm using Word 2010 if that means anything. You are right about the code I posted. It is edited for simplicity and just show the trouble spot. The part where I create and format the shape is within a With/End With statement. In fact it is the fourth shape that I create - two on page one and then two on page two (including the line in the header of page two). They are all created fine but when it tries to execute the line: ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument I get the error, "This method or property is not available because the current selection is not in a header or footer." Which doesn't make sense, of course, since the blasted line was created in the header. I've also tried to deselect the shape and select the paragraph mark inside the header but I still get the same error message. I've even selected the paragraph mark in the header as well as the shape and still get the same error message. Very strange.
  4. I'm using a VBA for Word macro that creates a series of shapes inside the headers and footers of the document. The last one that I create is a line shape in the header of page two. After the creation of this shape, I'd like to get back into the main document and continue on from there but I can't seem to make it happen. I get an error message that says, "This method or property is not available because the current selection is not in a header or footer." However, the shape is created in the header, so I don't understand why I'm getting this error message. Here's the code I'm using : 'Create the shape and set it's properties .Headers(wdHeaderFooterPrimary).Shapes.AddShape msoLine, 50, 40, 500, 1 ActiveDocument.Sections(1).Headers(wdHeaderFooterFirstPage).Shapes(4).Select 'Select the shape 'Set the shape's properties Selection.ShapeRange.Line.ForeColor = RGB(0, 0, 0) 'change line color to black Selection.ShapeRange.Shadow.Type = msoShadow6 'Get back into the main document ActiveWindow.ActivePane.View.SeekView = wdSeekMainDocument I've tried deselecting the shape in order to select the paragraph mark inside the header and I still get the same error message. I'm stumped. Any advice or help is greatly appreciated!
×
×
  • Create New...