Hi all,
Anyone please tell me how to run a macro through all the pages at a single instance in a malty page document.
Thanks in advance
Nishanth
Not possible unless the macro is programmed to do that.
Nishanth said:Anyone please tell me how to run a macro through all the pages at a single instance in a malty page document.
Hi.
Here's a few example I found in my piles of code,
This first example loops pages without activating the page. I prefer to activate the page as the second example below will show. This is because not all functions will work when the page is not activated.This code uses a loop with a control variable (i). (i) increments each time through the loop to reference the next page.
Private Sub Bitmap300D()Dim p As Page, i As Integer, sr As ShapeRangeFor i = 1 To ActiveDocument.Pages.count Set sr = ActiveDocument.Pages(i).Shapes.All sr.Shapes.All.ConvertToBitmapEx cdrCMYKColorImage, False, True, 300 'sr.Move 5, 0 'sr.Group.Fill.UniformColor.RGBAssign 255, 0, 0 Set sr = NothingNext iEnd Sub
This next example uses a For Each loop that loops through the pages using an object variable, (p) as page in this case. When you do this you activate each page so you can use references like ActivePage.Shapes.All or ActivePage.Layers, etc. This makes things very easy.
Private Sub layerTest1()Dim p As PageDim l As LayerDim vis As Boolean, txt As StringFor Each p In ActiveDocument.Pages p.Activate For Each l In ActivePage.Layers If l.Index = 0 Then txt = l.Name If l.Visible = True Then vis = True Else vis = False End If MsgBox "Page: " & p.Index & vbNewLine & " Layer Name: " & txt & vbNewLine & " Visibilty: " & vis End If Next lNext pEnd Sub
~John
Been meaning to make some more videos. Here's one I made today pertaining to looping.
http://community.coreldraw.com/blogs/gdgmacros/archive/2013/07/04/gdg-macros-lessons-looping-basics-part-1-of-3-blog-post-has-flash-video-with-sound.aspx
http://community.coreldraw.com/blogs/gdgmacros/archive/2013/07/04/gdg-macros-lessons-looping-basics-part-2-of-3-blog-post-has-flash-video-with-sound.aspx
http://community.coreldraw.com/blogs/gdgmacros/archive/2013/07/04/gdg-macros-lessons-looping-basics-part-3-of-3-blog-post-has-flash-video-with-sound.aspx