Setting custom margins for other users

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
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
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.

Forum statistics

Threads
1,215,006
Messages
6,122,665
Members
449,091
Latest member
peppernaut

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top