LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 81
Default Variable not defined compile error

Bob,

That fixed things. Thanks much for the help - have a great weekend.

Phil

"Bob Phillips" wrote:

Hi Phil,

Good old wrap-around problem

Declare Function GetSystemMetrics32 Lib "user32" Alias "GetSystemMetrics" _
(ByVal nIndex As Long) As Long
Dim zoom1, zoom2, zoom3, pagezoom1, pagezoom2, pagezoom3

Function DisplayVideoResolution() As String
DisplayVideoResolution = GetSystemMetrics32(0) & " x " & _
GetSystemMetrics32(1)
End Function


Sub Auto_Open()
Dim strResolution As String
strResolution = DisplayVideoResolution
If strResolution = "1024 x 768" Then
zoom1 = 78
zoom2 = 80
zoom3 = 81
pagezoom1 = 83
pagezoom2 = 87
pagezoom3 = 89
End If
RunSub1
End Sub



--
HTH

Bob Phillips

"Phil Hageman" wrote in message
...
Hi Bob,

Thanks for your reply. I pasted the code in and got a compile error:

Syntax
error. The line DisplayVideoResolution = GetSystemMetrics32(0) & " x " &

is
highligted. When a click OK on the message box, the line Function
DisplayVideoResolution() As String highlights yellow, and the Display....
line becomes red font. Where did I go wrong?

Thanks, Phil

"Bob Phillips" wrote:

You need a bit more code

Declare Function GetSystemMetrics32 Lib "user32" Alias

"GetSystemMetrics" _
(ByVal nIndex As Long) As Long
Dim zoom1, zoom2, zoom3, pagezoom1, pagezoom2, pagezoom3

Function DisplayVideoResolution() As String
DisplayVideoResolution = GetSystemMetrics32(0) & " x " &
GetSystemMetrics32(1)
End Function


Sub Auto_Open()
Dim strResolution As String
strResolution = DisplayVideoResolution
If strResolution = "1024 x 768" Then
zoom1 = 78
zoom2 = 80
zoom3 = 81
pagezoom1 = 83
pagezoom2 = 87
pagezoom3 = 89
End If
RunSub1
End Sub


Sub RunSub1()

End Sub

--
HTH

Bob Phillips

"Phil Hageman" wrote in message
...
I'm getting a compile error: Variable not defined, in Auto_Open.
DisplayVideoResolution is highlighted. What is the correction?

Sub Auto_Open()
Dim strResolution As String
strResolution = DisplayVideoResolution
If strResolution = "1024 x 768" Then
zoom1 = 78
zoom2 = 80
zoom3 = 81
pagezoom1 = 83
pagezoom2 = 87
pagezoom3 = 89
End If
RunSub1
End Sub
----------------------------------------------
Sub RunSub1()
-
-
-









 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Finding files in a folder. Variable not defined error. Ayo Excel Discussion (Misc queries) 1 March 14th 08 01:14 PM
Microsoft Visual Basic: Compile error: Sum or Function not defined Dmitry Excel Worksheet Functions 12 April 3rd 06 07:28 AM
"Compile error: sub or function not defined" Joe Excel Discussion (Misc queries) 4 January 30th 06 08:19 PM
Compile error, variable not defined davegb Excel Programming 5 May 19th 05 04:41 PM
compile error: expected variable or function MMM Excel Discussion (Misc queries) 3 December 24th 04 03:11 PM


All times are GMT +1. The time now is 02:30 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"