PDA

View Full Version : Solved: Getting current Screen Resolution



TrippyTom
12-04-2006, 10:30 AM
In the following link, Ken Puls shows how to determine Screen Resolution inside Excel. http://www.vbaexpress.com/forum/showthread.php?t=10321&highlight=screen+size

Does anyone know a similar way to do it in PowerPoint?

I'm trying to place my toolbar in the bottom right of my screen, but I have to figure out the resolution first. Here's the part of my code that I tried:

MsgBox (ActivePresentation.WebOptions.ScreenSize)
If ActivePresentation.WebOptions.ScreenSize = msoScreenSize800x600 Then
cmdBar.Left = 760
ElseIf ActivePresentation.WebOptions.ScreenSize = msoScreenSize1024x768 Then
cmdBar.Left = 984
ElseIf ActivePresentation.WebOptions.ScreenSize = msoScreenSize1152x882 Then
cmdBar.Left = 1112
ElseIf ActivePresentation.WebOptions.ScreenSize = msoScreenSize1152x900 Then
cmdBar.Left = 1112
ElseIf ActivePresentation.WebOptions.ScreenSize = msoScreenSize1280x1024 Then
cmdBar.Left = 1240
ElseIf ActivePresentation.WebOptions.ScreenSize = msoScreenSize1600x1200 Then
cmdBar.Left = 1560
ElseIf ActivePresentation.WebOptions.ScreenSize = msoScreenSize1800x1440 Then
cmdBar.Left = 1760
End If


But the value is coming back as "3" for some reason, and it's triggering only the first IF condition.
[edit:] -- Apparently "3" is the constant for 800x600, but I have no idea why it's triggering that because my resolution is at 1600x1200. Very strange. :(

Ken Puls
12-04-2006, 11:22 AM
Hi Tom,

If I recall, I worked on this issue in the "ScreenTiler" project a while ago. Check out this thread: http://www.vbaexpress.com/forum/showthread.php?t=6126

You'll need to downloaded the add-in, but it is unprotected so you can browse the code. I used it to change the window size, but I'm sure you can get what you need from it.

HTH,

TrippyTom
12-04-2006, 04:45 PM
Hi Ken,

I read that series of posts, and perhaps I'm asking my question in the wrong way. I assumed "screen size" was the actual windows setting in Desktop Properties. But from those posts in that link, it sounds more like just the size of the window -- which still confuses me because if my settings are at 1600x1200 and the window is maximized, why would it think it's at 800x600?

Anyway, what's the best way to handle this for my toolbar? I'm tired of it showing up in the middle of the screen every time I start PowerPoint (see image below). I can tell it to be at msobottom, but it adds the toolbar to its own row, instead of putting it next to another toolbar. This is something else that I'm perplexed about how to fix.

Ken Puls
12-04-2006, 05:11 PM
I read that series of posts, and perhaps I'm asking my question in the wrong way. I assumed "screen size" was the actual windows setting in Desktop Properties. But from those posts in that link, it sounds more like just the size of the window -- which still confuses me because if my settings are at 1600x1200 and the window is maximized, why would it think it's at 800x600?

Good question. The API returns screen size, as per your dekstop settings. I haven't played with the methods in powerpoint, so can't answer your question there. I agree, though, that it seems strange.


Anyway, what's the best way to handle this for my toolbar? I'm tired of it showing up in the middle of the screen every time I start PowerPoint (see image below). I can tell it to be at msobottom, but it adds the toolbar to its own row, instead of putting it next to another toolbar. This is something else that I'm perplexed about how to fix.

Also a good question, and again I'm not going to be much help. :( I've only ever fooled with custom toolbars a very little, and never worried about the positioning. Let me see if I can call someone who uses them more than I do. :)

TrippyTom
12-04-2006, 05:37 PM
I decided not to worry about the screen size at all. This is what I ended up doing. It puts it on the first row at the bottom, and that's good enough for me.

With cmdBar("myPlacement")
cmdBar.Position = msoBarBottom
cmdBar.RowIndex = 1
End With


Sorry for the confusion! :hi: