Resizing BackgroundPicture Gifs programmatically for varying screen resolutions

C

Charles Jordan

We have 20 workbooks, all of which have a background picture for
Sheet1. The problem is that we get *tiling* for any resolution
different from 1,024 x 768. The obvious solution is to test for the
user's screen resolution and import an appropriately sized Gif, which
means for say 10 resolutions, 10 gifs ..... times 20 workbooks.

Instead, what about inserting a master Gif into a holding worksheet,
testing for screen resolution, and resizing it appropriately. But,
even if we could do this resizing, the following code which is
supposed to then set the background picture, bombs with the error msg
"Picture does not have value property"

Worksheets("Sheet1").SetBackgroundPicture
Worksheets("Sheet4").Pictures("Picture 1")

Is there any solution to this ? Or any other way of using one master
Gif ?

TIA - Charles Jordan
 
N

NickHK

Charles ,
One thing: .SetBackgroundPicture expects a filename as a parameter. If the
gif is in a workbook, you can't supply that. You could copy and paste, but
then it's not in the background.

There is no .Pictures collection, only .OLEObjects and .Shapes, so I don't
think you can access the background picture once its there.

In terms of tiling, I get it everytime, it just that if the picture matches
your window size and you don't scroll right of down, it's not apparent.

Maybe the GetSystemMetric API and setting the scrollable area of the
worksheet may help.

NickHK
 
C

Charles Jordan

NickHK said:
Charles ,
One thing: .SetBackgroundPicture expects a filename as a parameter. If the
gif is in a workbook, you can't supply that. You could copy and paste, but
then it's not in the background.

There is no .Pictures collection, only .OLEObjects and .Shapes, so I don't
think you can access the background picture once its there.

In terms of tiling, I get it everytime, it just that if the picture matches
your window size and you don't scroll right of down, it's not apparent.

Maybe the GetSystemMetric API and setting the scrollable area of the
worksheet may help.

NickHK

NickHK - thanks . Sure there's a solution here somewhere - will keep
you posted. Charles
 
B

Bill Renaud

I believe tiling occurs regardless of screen resolution and/or picture size.
To delete the background picture, set the file name to a blank string.

Sub AddBackground()
ActiveSheet.SetBackgroundPicture Filename:="C:\My Documents\Test
Background.jpg"
End Sub

Sub DeleteBackground()
ActiveSheet.SetBackgroundPicture Filename:=""
End Sub

How important is it that the picture fit the user's full screen? Can the
picture simply be bigger than the screen, so that it appears to "truncate"
on monitors that are set to smaller resolutions? In other words, can you use
a single picture file (GIF or JPG) that will fit the largest screen
resolution used by all users?
 
C

Charles Jordan

Bill Renaud said:
I believe tiling occurs regardless of screen resolution and/or picture size.
To delete the background picture, set the file name to a blank string.

Sub AddBackground()
ActiveSheet.SetBackgroundPicture Filename:="C:\My Documents\Test
Background.jpg"
End Sub

Sub DeleteBackground()
ActiveSheet.SetBackgroundPicture Filename:=""
End Sub

How important is it that the picture fit the user's full screen? Can the
picture simply be bigger than the screen, so that it appears to "truncate"
on monitors that are set to smaller resolutions? In other words, can you use
a single picture file (GIF or JPG) that will fit the largest screen
resolution used by all users?

Bill - thanks - We may have to do as you suggest, but the trouble is
that each picture contains an image so can't really be truncated
without losing some.. I have just posted a query on another approach
to the problem, which is to *insert* the picture on the draw layer,
then resize it to fill the screen, and then dump it once the initial
splash is over.. But how to resize it?? ..

Tks Charles
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top