Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-08-2012, 05:10 AM
yAnn1ck yAnn1ck is offline Stretch image to fullpage macro Windows 7 64bit Stretch image to fullpage macro Office 2007
Novice
Stretch image to fullpage macro
 
Join Date: Apr 2012
Posts: 2
yAnn1ck is on a distinguished road
Default Stretch image to fullpage macro

Hi,



I'm trying to record a macro which stretches an image to the fullpage size, now I tried this at first by checking what the papersize type is and then just googling what the dimensions are. However if I use the same macro on another pc, the papersize dimensions are different. Is there a way I can get the dimensions of the papersize?

Thanks
Reply With Quote
  #2  
Old 04-08-2012, 10:28 PM
macropod's Avatar
macropod macropod is offline Stretch image to fullpage macro Windows 7 64bit Stretch image to fullpage macro Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,382
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You can get the page dimensions etc. with code like:
Code:
Sub GetPageDimensions()
' Define the variables
Dim Orientation As String, PageHeight As Single, PageWidth As Single
Dim MirrorMargins As Single, TopMargin As Single, BottomMargin As Single
Dim LeftMargin As Single, RightMargin As Single
With Selection.Sections.First.PageSetup
  If .Orientation = wdOrientPortrait Then
    Orientation = "Portrait"
  Else
    Orientation = "Landscape"
  End If
  PageHeight = .PageHeight
  PageWidth = .PageWidth
  MirrorMargins = .MirrorMargins
  TopMargin = .TopMargin
  BottomMargin = .BottomMargin
  LeftMargin = .LeftMargin
  RightMargin = .RightMargin
End With
' Inform the user
MsgBox "Orientation = " & Orientation & vbCr & _
  "PageHeight = " & PageHeight & vbCr & _
  "PageWidth = " & PageWidth & vbCr & _
  "MirrorMargins = " & MirrorMargins & vbCr & _
  "TopMargin = " & TopMargin & vbCr & _
  "BottomMargin = " & BottomMargin & vbCr & _
  "LeftMargin = " & LeftMargin & vbCr & _
  "RightMargin = " & RightMargin
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Stretch image to fullpage macro Macro fails to add image border in Word 2007 samhdc Word 1 03-30-2012 04:56 AM
URGENT!!! Powerpoint Image Formatting and Positioning Macro mertulufi PowerPoint 5 12-20-2011 10:14 AM
How do I assign a macro to a button when the macro is in my personal workbook? foolios Excel Programming 2 07-27-2011 02:41 PM
Stretch image to fullpage macro Adding Image into a excel cell and adding a hyperlink to the image saravananiyyanar Excel 3 05-04-2011 08:31 AM
Background image vs. insert image lilaria PowerPoint 0 04-18-2011 08:45 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:52 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft