Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
johanlind
Contributor II
Contributor II

Change screen resolution

Is there a way to change the screen resolution with a macro?

5 Replies
c_gilbert
Creator II
Creator II

I don't think so, but you can allow zooming with macros:

 

Sub ZoomFitToWindow

ActiveDocument.ActiveSheet.FitZoomToWindow
ActiveDocument.GetApplication.WaitforIdle
ActiveDocument.ActiveSheet.ApplyZoomToAllSheets

End Sub

sub ZoomIn

set mysheet=ActiveDocument.ActiveSheet
set sp=mysheet.GetProperties
sp.ZoomFactor = sp.ZoomFactor * 1.1
mysheet.SetProperties sp
ActiveDocument.GetApplication.WaitforIdle
ActiveDocument.ActiveSheet.ApplyZoomToAllSheets

end sub

sub ZoomOut

set mysheet=ActiveDocument.ActiveSheet
set sp=mysheet.GetProperties
sp.ZoomFactor = sp.ZoomFactor * 0.9
mysheet.SetProperties sp
ActiveDocument.GetApplication.WaitforIdle
ActiveDocument.ActiveSheet.ApplyZoomToAllSheets

end sub

Sub ZoomNormal

set mysheet=ActiveDocument.ActiveSheet
set sp=mysheet.GetProperties
sp.ZoomFactor = 1
mysheet.SetProperties sp
ActiveDocument.GetApplication.WaitforIdle
ActiveDocument.ActiveSheet.ApplyZoomToAllSheets

End Sub


johanlind
Contributor II
Contributor II
Author

I know how to change the zoom.

I want to take a screenshot/picture of a sheet with a macro, and the zoom function won't work with my macro for saving a picture.

Here is my macro for export a picture:

public function ExportImage

   vFolder = Destination folder

    ActiveDocument.GetSheetByID ("SH02").Activate

   set obj = ActiveDocument.GetSheetByID("SH02")

   ActiveDocument.GetApplication.WaitForIdle

   fileName = "SH02" & ".jpg"

   ActiveDocument.GetApplication.WaitForIdle

   obj.ExportBitmapToFile vFolder & fileName

end function

Any other ideas for doing this?

johanlind
Contributor II
Contributor II
Author

When I use the export function all objects will be exported in its original size, but the window(picture) size will change to the resolution I have set the window to.

Anonymous
Not applicable

Did you ever find a solution to  this?

I am most likely trying to exactly the same and am stuck between resolutions for a logged on computer, the server default resolution etc.

Kind regards

Niklas