Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Why Won't This Macro Work?

The following macro is installed in "This Workbook." All it needs to do is
identify the user's OS. If the OS is a Mac, the window maximizes and positons
itself in a certain way. If the OS is Windows (or any non-Mac OS), it should
position the window similarly, but then also cycle through each sheet and set
the font characteristics as shown. The macro works fine when I just run it,
but, even though it's in "This Workbook" and setup as an Open event, it
doesn't do anything on a PC--it doesn't error out, it just doesn't do
anything. The macro DOES position the window correctly on a Mac, but again,
on a PC, nothing happens at all. In particular, I really need the font to set
to 8 on a PC (but not on a Mac). Does anyone have any ideas? (If I can get it
to work, my ultimate plan is to modify the Mac part to rescale the font to
10, but that's assuming I can get the rest of it to go in the first place.)

Private Sub Workbook_Open()
If Application.OperatingSystem Like "*Mac*" Then
ActiveWindow.Zoom = 100
With ActiveWindow
.Top = 1
.Left = 1
.Height = Application.UsableHeight
.Width = Application.UsableWidth
End With
Else
With ActiveWindow
.WindowState = xlNormal
.Top = 1
.Left = 1
.Height = Application.UsableHeight
.Width = Application.UsableWidth
End With
Dim S As Worksheet
For Each S In ActiveWorkbook.Worksheets
Cells.Select
With Selection.Font
.Name = "Verdana"
.Size = 8
End With
Next
Sheets(1).Activate
End If
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7,247
Default Why Won't This Macro Work?

Is it possible that (1) macros are disabled on the PC, or (2)
Application.EnableEvents is set to False?


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2008
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)

"Pausert of Nikkeldepaiin"
m wrote in message
...
The following macro is installed in "This Workbook." All it needs to do is
identify the user's OS. If the OS is a Mac, the window maximizes and
positons
itself in a certain way. If the OS is Windows (or any non-Mac OS), it
should
position the window similarly, but then also cycle through each sheet and
set
the font characteristics as shown. The macro works fine when I just run
it,
but, even though it's in "This Workbook" and setup as an Open event, it
doesn't do anything on a PC--it doesn't error out, it just doesn't do
anything. The macro DOES position the window correctly on a Mac, but
again,
on a PC, nothing happens at all. In particular, I really need the font to
set
to 8 on a PC (but not on a Mac). Does anyone have any ideas? (If I can get
it
to work, my ultimate plan is to modify the Mac part to rescale the font to
10, but that's assuming I can get the rest of it to go in the first
place.)

Private Sub Workbook_Open()
If Application.OperatingSystem Like "*Mac*" Then
ActiveWindow.Zoom = 100
With ActiveWindow
.Top = 1
.Left = 1
.Height = Application.UsableHeight
.Width = Application.UsableWidth
End With
Else
With ActiveWindow
.WindowState = xlNormal
.Top = 1
.Left = 1
.Height = Application.UsableHeight
.Width = Application.UsableWidth
End With
Dim S As Worksheet
For Each S In ActiveWorkbook.Worksheets
Cells.Select
With Selection.Font
.Name = "Verdana"
.Size = 8
End With
Next
Sheets(1).Activate
End If
End Sub


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Why Won't This Macro Work?

This tested on my Vista Home Premium xl2003 all updates.

Sub opersys()
If Application.OperatingSystem Like "*Mac*" Then
MsgBox "mac"

Else

For Each ws In Worksheets
With ws.Cells.Font
.Name = "Verdana"
.Size = 8
End With
Next ws

End If
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Pausert of Nikkeldepaiin"
m wrote in message
...
The following macro is installed in "This Workbook." All it needs to do is
identify the user's OS. If the OS is a Mac, the window maximizes and
positons
itself in a certain way. If the OS is Windows (or any non-Mac OS), it
should
position the window similarly, but then also cycle through each sheet and
set
the font characteristics as shown. The macro works fine when I just run
it,
but, even though it's in "This Workbook" and setup as an Open event, it
doesn't do anything on a PC--it doesn't error out, it just doesn't do
anything. The macro DOES position the window correctly on a Mac, but
again,
on a PC, nothing happens at all. In particular, I really need the font to
set
to 8 on a PC (but not on a Mac). Does anyone have any ideas? (If I can get
it
to work, my ultimate plan is to modify the Mac part to rescale the font to
10, but that's assuming I can get the rest of it to go in the first
place.)

Private Sub Workbook_Open()
If Application.OperatingSystem Like "*Mac*" Then
ActiveWindow.Zoom = 100
With ActiveWindow
.Top = 1
.Left = 1
.Height = Application.UsableHeight
.Width = Application.UsableWidth
End With
Else
With ActiveWindow
.WindowState = xlNormal
.Top = 1
.Left = 1
.Height = Application.UsableHeight
.Width = Application.UsableWidth
End With
Dim S As Worksheet
For Each S In ActiveWorkbook.Worksheets
Cells.Select
With Selection.Font
.Name = "Verdana"
.Size = 8
End With
Next
Sheets(1).Activate
End If
End Sub


  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Why Won't This Macro Work?

Don and Chip:

Sorry about the delay in replying. I'm at work (where I'm on a Mac) so, to
test these things, I have to email them to my wife at HER work, since she's
on a PC, so there's always kind of a "testing lag."

Anyway, I checked for Chip's idea about "enable events" being false, and
that doesn't seem to be the case. So then I tried Don's idea and put the
following macro in a new workbook.

Private Sub Workbook_Open()
If Application.OperatingSystem Like "*Mac*" Then
MsgBox "Mac"

Else

For Each ws In Worksheets
With ws.Cells.Font
..Name = "Verdana"
..Size = 30
End With
Next ws

End If
End Sub

I put this code into "This Workbook" and then opened the thing on my Mac. (I
chose 30 for the font size just to make it really obvious when it worked.)
The message box correctly popped up. Then I emailed the same workbook to my
wife. She DOESN'T get the Mac box (hurray!), but then, the font on the sheets
doesn't change, either. I verified that she's enabling macros, and indeed, I
often send her things to test for me, so I don't think it's anyting she's
accidentally doing. (She runs Windows XP there, and she's always been able to
get my macros to work just fine in the past.)

So I'm stumped. If either of you have any ideas, I'd be most appreciative. I
have a dense spreadsheet that I really need to optimize for viewing and
printing on both platforms, and I'm running out of ideas.

Pausert

"Don Guillett" wrote:

This tested on my Vista Home Premium xl2003 all updates.

Sub opersys()
If Application.OperatingSystem Like "*Mac*" Then
MsgBox "mac"

Else

For Each ws In Worksheets
With ws.Cells.Font
.Name = "Verdana"
.Size = 8
End With
Next ws

End If
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Pausert of Nikkeldepaiin"
m wrote in message
...
The following macro is installed in "This Workbook." All it needs to do is
identify the user's OS. If the OS is a Mac, the window maximizes and
positons
itself in a certain way. If the OS is Windows (or any non-Mac OS), it
should
position the window similarly, but then also cycle through each sheet and
set
the font characteristics as shown. The macro works fine when I just run
it,
but, even though it's in "This Workbook" and setup as an Open event, it
doesn't do anything on a PC--it doesn't error out, it just doesn't do
anything. The macro DOES position the window correctly on a Mac, but
again,
on a PC, nothing happens at all. In particular, I really need the font to
set
to 8 on a PC (but not on a Mac). Does anyone have any ideas? (If I can get
it
to work, my ultimate plan is to modify the Mac part to rescale the font to
10, but that's assuming I can get the rest of it to go in the first
place.)

Private Sub Workbook_Open()
If Application.OperatingSystem Like "*Mac*" Then
ActiveWindow.Zoom = 100
With ActiveWindow
.Top = 1
.Left = 1
.Height = Application.UsableHeight
.Width = Application.UsableWidth
End With
Else
With ActiveWindow
.WindowState = xlNormal
.Top = 1
.Left = 1
.Height = Application.UsableHeight
.Width = Application.UsableWidth
End With
Dim S As Worksheet
For Each S In ActiveWorkbook.Worksheets
Cells.Select
With Selection.Font
.Name = "Verdana"
.Size = 8
End With
Next
Sheets(1).Activate
End If
End Sub



  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Why Won't This Macro Work?

Hi, Chip! I just sent off a reply to both you and Don G.--It's attached to
his response since it was the last one. Thnaks for your time!

"Chip Pearson" wrote:

Is it possible that (1) macros are disabled on the PC, or (2)
Application.EnableEvents is set to False?


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2008
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)

"Pausert of Nikkeldepaiin"
m wrote in message
...
The following macro is installed in "This Workbook." All it needs to do is
identify the user's OS. If the OS is a Mac, the window maximizes and
positons
itself in a certain way. If the OS is Windows (or any non-Mac OS), it
should
position the window similarly, but then also cycle through each sheet and
set
the font characteristics as shown. The macro works fine when I just run
it,
but, even though it's in "This Workbook" and setup as an Open event, it
doesn't do anything on a PC--it doesn't error out, it just doesn't do
anything. The macro DOES position the window correctly on a Mac, but
again,
on a PC, nothing happens at all. In particular, I really need the font to
set
to 8 on a PC (but not on a Mac). Does anyone have any ideas? (If I can get
it
to work, my ultimate plan is to modify the Mac part to rescale the font to
10, but that's assuming I can get the rest of it to go in the first
place.)

Private Sub Workbook_Open()
If Application.OperatingSystem Like "*Mac*" Then
ActiveWindow.Zoom = 100
With ActiveWindow
.Top = 1
.Left = 1
.Height = Application.UsableHeight
.Width = Application.UsableWidth
End With
Else
With ActiveWindow
.WindowState = xlNormal
.Top = 1
.Left = 1
.Height = Application.UsableHeight
.Width = Application.UsableWidth
End With
Dim S As Worksheet
For Each S In ActiveWorkbook.Worksheets
Cells.Select
With Selection.Font
.Name = "Verdana"
.Size = 8
End With
Next
Sheets(1).Activate
End If
End Sub




  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Why Won't This Macro Work?

I probably won't be able to help because I don't use mac but my guess? is
that there is a compatibility issue with the mac workbook not working on
XP??. All I can tell you is that I did the macro on a pc. If you like, send
me the file and I will try on my computer to see if I get the change.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Pausert of Nikkeldepaiin"
m wrote in message
...
Don and Chip:

Sorry about the delay in replying. I'm at work (where I'm on a Mac) so, to
test these things, I have to email them to my wife at HER work, since
she's
on a PC, so there's always kind of a "testing lag."

Anyway, I checked for Chip's idea about "enable events" being false, and
that doesn't seem to be the case. So then I tried Don's idea and put the
following macro in a new workbook.

Private Sub Workbook_Open()
If Application.OperatingSystem Like "*Mac*" Then
MsgBox "Mac"

Else

For Each ws In Worksheets
With ws.Cells.Font
.Name = "Verdana"
.Size = 30
End With
Next ws

End If
End Sub

I put this code into "This Workbook" and then opened the thing on my Mac.
(I
chose 30 for the font size just to make it really obvious when it worked.)
The message box correctly popped up. Then I emailed the same workbook to
my
wife. She DOESN'T get the Mac box (hurray!), but then, the font on the
sheets
doesn't change, either. I verified that she's enabling macros, and indeed,
I
often send her things to test for me, so I don't think it's anyting she's
accidentally doing. (She runs Windows XP there, and she's always been able
to
get my macros to work just fine in the past.)

So I'm stumped. If either of you have any ideas, I'd be most appreciative.
I
have a dense spreadsheet that I really need to optimize for viewing and
printing on both platforms, and I'm running out of ideas.

Pausert

"Don Guillett" wrote:

This tested on my Vista Home Premium xl2003 all updates.

Sub opersys()
If Application.OperatingSystem Like "*Mac*" Then
MsgBox "mac"

Else

For Each ws In Worksheets
With ws.Cells.Font
.Name = "Verdana"
.Size = 8
End With
Next ws

End If
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Pausert of Nikkeldepaiin"
m wrote in message
...
The following macro is installed in "This Workbook." All it needs to do
is
identify the user's OS. If the OS is a Mac, the window maximizes and
positons
itself in a certain way. If the OS is Windows (or any non-Mac OS), it
should
position the window similarly, but then also cycle through each sheet
and
set
the font characteristics as shown. The macro works fine when I just run
it,
but, even though it's in "This Workbook" and setup as an Open event, it
doesn't do anything on a PC--it doesn't error out, it just doesn't do
anything. The macro DOES position the window correctly on a Mac, but
again,
on a PC, nothing happens at all. In particular, I really need the font
to
set
to 8 on a PC (but not on a Mac). Does anyone have any ideas? (If I can
get
it
to work, my ultimate plan is to modify the Mac part to rescale the font
to
10, but that's assuming I can get the rest of it to go in the first
place.)

Private Sub Workbook_Open()
If Application.OperatingSystem Like "*Mac*" Then
ActiveWindow.Zoom = 100
With ActiveWindow
.Top = 1
.Left = 1
.Height = Application.UsableHeight
.Width = Application.UsableWidth
End With
Else
With ActiveWindow
.WindowState = xlNormal
.Top = 1
.Left = 1
.Height = Application.UsableHeight
.Width = Application.UsableWidth
End With
Dim S As Worksheet
For Each S In ActiveWorkbook.Worksheets
Cells.Select
With Selection.Font
.Name = "Verdana"
.Size = 8
End With
Next
Sheets(1).Activate
End If
End Sub




  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10
Default Why Won't This Macro Work?

Thnaks for the offer, Don. On Sunday, though, I tracked down another PC and
tried the workbook on that--and it did exactly what it's supposed to do. At
this point, I'm going to assume that there's something funky going on with my
wife's PC. Or that she's on acid or something and disabling the macros while
in some altered state.

Again, though, thanks for both your improved macro and your offer to help! I
much appreatie it!

"Don Guillett" wrote:

I probably won't be able to help because I don't use mac but my guess? is
that there is a compatibility issue with the mac workbook not working on
XP??. All I can tell you is that I did the macro on a pc. If you like, send
me the file and I will try on my computer to see if I get the change.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Pausert of Nikkeldepaiin"
m wrote in message
...
Don and Chip:

Sorry about the delay in replying. I'm at work (where I'm on a Mac) so, to
test these things, I have to email them to my wife at HER work, since
she's
on a PC, so there's always kind of a "testing lag."

Anyway, I checked for Chip's idea about "enable events" being false, and
that doesn't seem to be the case. So then I tried Don's idea and put the
following macro in a new workbook.

Private Sub Workbook_Open()
If Application.OperatingSystem Like "*Mac*" Then
MsgBox "Mac"

Else

For Each ws In Worksheets
With ws.Cells.Font
.Name = "Verdana"
.Size = 30
End With
Next ws

End If
End Sub

I put this code into "This Workbook" and then opened the thing on my Mac.
(I
chose 30 for the font size just to make it really obvious when it worked.)
The message box correctly popped up. Then I emailed the same workbook to
my
wife. She DOESN'T get the Mac box (hurray!), but then, the font on the
sheets
doesn't change, either. I verified that she's enabling macros, and indeed,
I
often send her things to test for me, so I don't think it's anyting she's
accidentally doing. (She runs Windows XP there, and she's always been able
to
get my macros to work just fine in the past.)

So I'm stumped. If either of you have any ideas, I'd be most appreciative.
I
have a dense spreadsheet that I really need to optimize for viewing and
printing on both platforms, and I'm running out of ideas.

Pausert

"Don Guillett" wrote:

This tested on my Vista Home Premium xl2003 all updates.

Sub opersys()
If Application.OperatingSystem Like "*Mac*" Then
MsgBox "mac"

Else

For Each ws In Worksheets
With ws.Cells.Font
.Name = "Verdana"
.Size = 8
End With
Next ws

End If
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Pausert of Nikkeldepaiin"
m wrote in message
...
The following macro is installed in "This Workbook." All it needs to do
is
identify the user's OS. If the OS is a Mac, the window maximizes and
positons
itself in a certain way. If the OS is Windows (or any non-Mac OS), it
should
position the window similarly, but then also cycle through each sheet
and
set
the font characteristics as shown. The macro works fine when I just run
it,
but, even though it's in "This Workbook" and setup as an Open event, it
doesn't do anything on a PC--it doesn't error out, it just doesn't do
anything. The macro DOES position the window correctly on a Mac, but
again,
on a PC, nothing happens at all. In particular, I really need the font
to
set
to 8 on a PC (but not on a Mac). Does anyone have any ideas? (If I can
get
it
to work, my ultimate plan is to modify the Mac part to rescale the font
to
10, but that's assuming I can get the rest of it to go in the first
place.)

Private Sub Workbook_Open()
If Application.OperatingSystem Like "*Mac*" Then
ActiveWindow.Zoom = 100
With ActiveWindow
.Top = 1
.Left = 1
.Height = Application.UsableHeight
.Width = Application.UsableWidth
End With
Else
With ActiveWindow
.WindowState = xlNormal
.Top = 1
.Left = 1
.Height = Application.UsableHeight
.Width = Application.UsableWidth
End With
Dim S As Worksheet
For Each S In ActiveWorkbook.Worksheets
Cells.Select
With Selection.Font
.Name = "Verdana"
.Size = 8
End With
Next
Sheets(1).Activate
End If
End Sub




  #8   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 10,124
Default Why Won't This Macro Work?


You're welcome. BTW, Your wife is getting a copy of this msg.
--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Pausert of Nikkeldepaiin"
m wrote in message
...
Thnaks for the offer, Don. On Sunday, though, I tracked down another PC
and
tried the workbook on that--and it did exactly what it's supposed to do.
At
this point, I'm going to assume that there's something funky going on with
my
wife's PC. Or that she's on acid or something and disabling the macros
while
in some altered state.

Again, though, thanks for both your improved macro and your offer to help!
I
much appreatie it!

"Don Guillett" wrote:

I probably won't be able to help because I don't use mac but my guess? is
that there is a compatibility issue with the mac workbook not working on
XP??. All I can tell you is that I did the macro on a pc. If you like,
send
me the file and I will try on my computer to see if I get the change.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Pausert of Nikkeldepaiin"
m wrote in message
...
Don and Chip:

Sorry about the delay in replying. I'm at work (where I'm on a Mac) so,
to
test these things, I have to email them to my wife at HER work, since
she's
on a PC, so there's always kind of a "testing lag."

Anyway, I checked for Chip's idea about "enable events" being false,
and
that doesn't seem to be the case. So then I tried Don's idea and put
the
following macro in a new workbook.

Private Sub Workbook_Open()
If Application.OperatingSystem Like "*Mac*" Then
MsgBox "Mac"

Else

For Each ws In Worksheets
With ws.Cells.Font
.Name = "Verdana"
.Size = 30
End With
Next ws

End If
End Sub

I put this code into "This Workbook" and then opened the thing on my
Mac.
(I
chose 30 for the font size just to make it really obvious when it
worked.)
The message box correctly popped up. Then I emailed the same workbook
to
my
wife. She DOESN'T get the Mac box (hurray!), but then, the font on the
sheets
doesn't change, either. I verified that she's enabling macros, and
indeed,
I
often send her things to test for me, so I don't think it's anyting
she's
accidentally doing. (She runs Windows XP there, and she's always been
able
to
get my macros to work just fine in the past.)

So I'm stumped. If either of you have any ideas, I'd be most
appreciative.
I
have a dense spreadsheet that I really need to optimize for viewing and
printing on both platforms, and I'm running out of ideas.

Pausert

"Don Guillett" wrote:

This tested on my Vista Home Premium xl2003 all updates.

Sub opersys()
If Application.OperatingSystem Like "*Mac*" Then
MsgBox "mac"

Else

For Each ws In Worksheets
With ws.Cells.Font
.Name = "Verdana"
.Size = 8
End With
Next ws

End If
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"Pausert of Nikkeldepaiin"
m wrote in message
...
The following macro is installed in "This Workbook." All it needs to
do
is
identify the user's OS. If the OS is a Mac, the window maximizes and
positons
itself in a certain way. If the OS is Windows (or any non-Mac OS),
it
should
position the window similarly, but then also cycle through each
sheet
and
set
the font characteristics as shown. The macro works fine when I just
run
it,
but, even though it's in "This Workbook" and setup as an Open event,
it
doesn't do anything on a PC--it doesn't error out, it just doesn't
do
anything. The macro DOES position the window correctly on a Mac, but
again,
on a PC, nothing happens at all. In particular, I really need the
font
to
set
to 8 on a PC (but not on a Mac). Does anyone have any ideas? (If I
can
get
it
to work, my ultimate plan is to modify the Mac part to rescale the
font
to
10, but that's assuming I can get the rest of it to go in the first
place.)

Private Sub Workbook_Open()
If Application.OperatingSystem Like "*Mac*" Then
ActiveWindow.Zoom = 100
With ActiveWindow
.Top = 1
.Left = 1
.Height = Application.UsableHeight
.Width = Application.UsableWidth
End With
Else
With ActiveWindow
.WindowState = xlNormal
.Top = 1
.Left = 1
.Height = Application.UsableHeight
.Width = Application.UsableWidth
End With
Dim S As Worksheet
For Each S In ActiveWorkbook.Worksheets
Cells.Select
With Selection.Font
.Name = "Verdana"
.Size = 8
End With
Next
Sheets(1).Activate
End If
End Sub





Reply
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
how to get a macro to work Danny Excel Discussion (Misc queries) 8 August 20th 07 01:30 PM
macro for work book Daniel Charts and Charting in Excel 1 August 12th 07 12:04 AM
Macro will work on one computer but not on another Gillian Excel Worksheet Functions 11 June 15th 07 08:57 PM
Why does the macro not work? Xanadude Excel Worksheet Functions 4 April 24th 05 09:06 PM
how do you get (end down) to work in a macro? lcx2 Excel Worksheet Functions 1 March 24th 05 08:15 AM


All times are GMT +1. The time now is 07:03 AM.

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

About Us

"It's about Microsoft Excel"