Mikeymike_W
Board Regular
- Joined
- Feb 25, 2016
- Messages
- 171
Hi There,
I have a sheet with an image on it. It is A5 landscape.
I have a userform which populates a few textboxes which are overlaid on the image. It all works fine for me however there are othe users and when they open it and when they save to PDF the side of the image encroaches onto a second sheet which means the PDF is saved over two pages.
I hae set the following code in the "Create" button of the Userform, I have also put the code for the page layout and margins in the workbook open event. Despite this it doesnt seem to fix the problem for the other users.... Is there something obvious i'm missing or perhaps a tip you could help me out with?
Many thanks,
Mike
I have a sheet with an image on it. It is A5 landscape.
I have a userform which populates a few textboxes which are overlaid on the image. It all works fine for me however there are othe users and when they open it and when they save to PDF the side of the image encroaches onto a second sheet which means the PDF is saved over two pages.
I hae set the following code in the "Create" button of the Userform, I have also put the code for the page layout and margins in the workbook open event. Despite this it doesnt seem to fix the problem for the other users.... Is there something obvious i'm missing or perhaps a tip you could help me out with?
Many thanks,
Mike
VBA Code:
Private Sub CBCreate1_Click()
On Error Resume Next
Application.ScreenUpdating = False
Worksheets("Customer List").Activate
Dim rw As Long 'next available row
Dim sPath As String, i As Long
Dim ws As Worksheet
Set ws = Worksheets("Customer List")
ActiveSheet.Range("A1").Select
'get the next avialable row in Sheet1
rw = ws.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).Row
ws.ListObjects("Data").ListRows.Add
'put the text box values in this row
With ws
.Cells(rw, "A").Value = Me.TBDOP.Value
.Cells(rw, "B").Value = Me.TBFrom.Value
.Cells(rw, "C").Value = Me.TBTo.Value
.Cells(rw, "D").Value = "30 Minute Reading"
.Cells(rw, "E").Value = Me.TBRef.Value
End With
Worksheets("Voucher").Activate
Sheets("Voucher").TextBox1.Value = TBFrom.Value
Sheets("Voucher").TextBox2.Value = TBTo.Value
Sheets("Voucher").TextBox3.Value = TBRef.Value
Sheets("Voucher").TextBox4.Value = TBDOP.Value
ActiveWindow.View = xlPageLayoutView
With ActiveSheet.PageSetup
.Orientation = xlLandscape
.PaperSize = xlPaperA5
.LeftMargin = Application.InchesToPoints(3.93700787401575E-02)
.RightMargin = Application.InchesToPoints(3.93700787401575E-02)
.TopMargin = Application.InchesToPoints(3.93700787401575E-02)
.BottomMargin = Application.InchesToPoints(3.93700787401575E-02)
.HeaderMargin = Application.InchesToPoints(0.118110236220472)
.FooterMargin = Application.InchesToPoints(0.118110236220472)
End With
'save as PDF
Dim strFile As String
strFile = Application.GetSaveAsFilename(FileFilter:="PDF Files (*.pdf),*.pdf")
If strFile = "False" Then
Beep
Exit Sub
End If
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=strFile, _
Quality:=xlQualityStandard, IncludeDocProperties:=True, _
IgnorePrintAreas:=False, OpenAfterPublish:=True
Application.ScreenUpdating = True
Unload Me
End Sub