AreDeeKay
11-01-2012, 02:30 AM
Hello All,
Very new here and to VBA Itself so i apologize in advance for my naivety.
I need to write a macro that uses an InputBox to collect data that will set the documents left and right margins. After much arduous researching through tutorials and the like, i have started with just the left margin, but am receiving this error "Runtime error '13' type mismatch.
i have tried many other ways to get this code to work but all have failed, here is the exact code that i have written.
Option Explicit
Sub SetPageMargins()
Dim strSetLeft As String
strSetLeft = InputBox("Please enter the size of left margin in cm", "Left Margin")
If strSetLeft <> "" Then
With ActiveDocument.PageSetup
.LeftMargin = CentimetersToPoints("")
End With
End If
End Sub
If anyone could point me in the right direction, if i am even heading there at all i would be extremely grateful. or if anyone knows of any tutorials that may help that would help allot also.
Thanks a Bunch!
-AreDeeKay
Very new here and to VBA Itself so i apologize in advance for my naivety.
I need to write a macro that uses an InputBox to collect data that will set the documents left and right margins. After much arduous researching through tutorials and the like, i have started with just the left margin, but am receiving this error "Runtime error '13' type mismatch.
i have tried many other ways to get this code to work but all have failed, here is the exact code that i have written.
Option Explicit
Sub SetPageMargins()
Dim strSetLeft As String
strSetLeft = InputBox("Please enter the size of left margin in cm", "Left Margin")
If strSetLeft <> "" Then
With ActiveDocument.PageSetup
.LeftMargin = CentimetersToPoints("")
End With
End If
End Sub
If anyone could point me in the right direction, if i am even heading there at all i would be extremely grateful. or if anyone knows of any tutorials that may help that would help allot also.
Thanks a Bunch!
-AreDeeKay