VIX
New Member
I am using a VB code for exporting a worksheet to various PDF pages everything works fine but after execution current cell jumps 36 (which is the number of pages in the sheet) cells from current position can anyone explain me the reason i am pasting the code below
Code:
Sub Export()
Dim pages As Integer
Dim fname As String
pages = 1
fname = Worksheets("FILENAME").Range("c2").Value
Do
Worksheets("Sal Slip - PM").Activate
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, filename:=Worksheets("Sal Slip - PM").Range("B11") & fname, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
From:=pages, To:=pages, OpenAfterPublish:=False
SendKeys filename & "{enter}"
pages = pages + 1
fname = Worksheets("FILENAME").Range("c2").Offset(pages - 1, 0)
Loop Until pages > Cells(3, 2)
End Sub