Hello everyone,
I'm working on VBA CATIA project, that need to be connected with Excel to save Data, and I do have to adjust the page size to A4 or A3 depend on the result of OptionButtons (pict bellow ), I tried this code but I got this error message "Run Time error 1004" 'impossible to define the property of PaperSize
Does anyone have any suggestions what wrong it is?
Thanks in advance for any suggestions
regards,
I'm working on VBA CATIA project, that need to be connected with Excel to save Data, and I do have to adjust the page size to A4 or A3 depend on the result of OptionButtons (pict bellow ), I tried this code but I got this error message "Run Time error 1004" 'impossible to define the property of PaperSize
Code:
Private Sub OptionButton1_Click()
If OptionButton1.Value = True Then
With AppliExcel.ActiveSheet.PageSetup
.PaperSize = xlPaperA4
End With
AppliExcel.Application.PrintCommunication = True
AppliExcel.ActiveWindow.View = xlPageLayoutView
End If
End Sub
Private Sub OptionButton2_Click()
If OptionButton2.Value = True Then
With AppliExcel.ActiveSheet.PageSetup
.PaperSize = xlPaperA3
End With
AppliExcel.Application.PrintCommunication = True
AppliExcel.ActiveWindow.View = xlPageLayoutView
End If
End Sub
Public AppliExcel As Object
Private Sub UserForm_Initialize()
Set AppliExcel = CreateObject("Excel.Application")
AppliExcel.Visible = True
AppliExcel.Workbooks.Add
End Sub
Does anyone have any suggestions what wrong it is?
Thanks in advance for any suggestions
regards,