Results 1 to 2 of 2

Thread: [RESOLVED] internet explorer pagesetup

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2006
    Posts
    3

    Resolved [RESOLVED] internet explorer pagesetup

    hi all!

    I'm facing the following problem:

    I need to change the page margin of an internet explorer document out of an excel application (for printing)

    as far as I know there is the possibility of changing the PageSetup registry key, but in excel it is not possible to use a statement like 'Dim aKey As RegistryKey'

    is there a way to use the statement above in excel or does anyone know an alternative without using the registry?

    any help would be appreciated

    thx

  2. #2

    Thread Starter
    New Member
    Join Date
    Apr 2006
    Posts
    3

    Resolved Re: internet explorer pagesetup

    ok I solved it that way:

    VB Code:
    1. Sub Change_RegKey()
    2.     Dim myWSH As Object
    3.     Dim myRegKey As String
    4.     Dim myNewValue As Double
    5.     Dim myNewStringValue As String
    6.  
    7.     Set myWSH = CreateObject("WScript.Shell")
    8.  
    9.     'e.g. margin top
    10.     myRegKey = "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\PageSetup\margin_top"
    11.     myNewValue = (19.05 / 25.4) 'mm to inch
    12.     myNewStringValue = myNewValue
    13.     myNewStringValue = Replace(myNewStringValue, ",", ".") 'replace "," (because of regional settings)
    14.     'write new value
    15.     myWSH.regWrite myRegKey, myNewStringValue, "REG_SZ"
    16.  
    17. End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width