Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default My macro doesn't work with other people's computers?

I have a simple macro to show custom views that are launched by a combo box.
It works fine on my computer, but crashes sporadically on other people's
machines in the office. We work on a shared network drive. Any ideas?
Here's my code:
Private Sub Markets_Change()
Dim varView As String
View = ActiveSheet.Range("b2")
ActiveWorkbook.CustomViews(View).Show
End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default My macro doesn't work with other people's computers?

Hi Gary,

What error message do other users encounter and,
on error, which line of code is highlighted?

By the way, I would change:

View = ActiveSheet.Range("b2")


to

View = ActiveSheet.Range("b2").Value

or, if the ComboBox is from the Controls Toolbox,

View = Me.Range("B2")

Additionally - though I assume that it is a typo:

ActiveWorkbook.CustomViews(View).Show


should probably be

ActiveWorkbook.CustomViews( varView ).Show



---
Regards,
Norman


"gary_wyman" wrote in message
...
I have a simple macro to show custom views that are launched by a combo
box.
It works fine on my computer, but crashes sporadically on other people's
machines in the office. We work on a shared network drive. Any ideas?
Here's my code:
Private Sub Markets_Change()
Dim varView As String
View = ActiveSheet.Range("b2")
ActiveWorkbook.CustomViews(View).Show
End Sub



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,101
Default My macro doesn't work with other people's computers?

Private Sub Markets_Change()
Dim varView As String
'If varView is string shouldn't view be
varView = ActiveSheet.Range("b2")
'View = ActiveSheet.Range("b2")
ActiveWorkbook.CustomViews(View).Show
End Sub

"gary_wyman" wrote:

I have a simple macro to show custom views that are launched by a combo box.
It works fine on my computer, but crashes sporadically on other people's
machines in the office. We work on a shared network drive. Any ideas?
Here's my code:
Private Sub Markets_Change()
Dim varView As String
View = ActiveSheet.Range("b2")
ActiveWorkbook.CustomViews(View).Show
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,391
Default My macro doesn't work with other people's computers?

Gary,
It would be a good idea to read about 'Option Explicit" in the Help.

Hint: varView < View

NickHK

"gary_wyman" wrote in message
...
I have a simple macro to show custom views that are launched by a combo

box.
It works fine on my computer, but crashes sporadically on other people's
machines in the office. We work on a shared network drive. Any ideas?
Here's my code:
Private Sub Markets_Change()
Dim varView As String
View = ActiveSheet.Range("b2")
ActiveWorkbook.CustomViews(View).Show
End Sub



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default My macro doesn't work with other people's computers?

Thanks, but the changes didn't work. Still crashes at least every other time
it is run. Hangs up on ActiveWorkbook.CustomViews(View).Show with an error
code 5.

"Mike" wrote:

Private Sub Markets_Change()
Dim varView As String
'If varView is string shouldn't view be
varView = ActiveSheet.Range("b2")
'View = ActiveSheet.Range("b2")
ActiveWorkbook.CustomViews(View).Show
End Sub

"gary_wyman" wrote:

I have a simple macro to show custom views that are launched by a combo box.
It works fine on my computer, but crashes sporadically on other people's
machines in the office. We work on a shared network drive. Any ideas?
Here's my code:
Private Sub Markets_Change()
Dim varView As String
View = ActiveSheet.Range("b2")
ActiveWorkbook.CustomViews(View).Show
End Sub



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default My macro doesn't work with other people's computers?

The use of Me.Range ("b2") didn't work either. It caused Excel to crash.
The macro is hanging up on ActiveWorkbook.CustomViews(View).Show with an
error code 5. It seems to happen every other attempt to launch the macro.

I did try using a text box with the macro assigned and the varView
suggestion and that seems to work. Don't understand why.

Thanks for your help as I am new to vba.

"Norman Jones" wrote:

Hi Gary,

What error message do other users encounter and,
on error, which line of code is highlighted?

By the way, I would change:

View = ActiveSheet.Range("b2")


to

View = ActiveSheet.Range("b2").Value

or, if the ComboBox is from the Controls Toolbox,

View = Me.Range("B2")

Additionally - though I assume that it is a typo:

ActiveWorkbook.CustomViews(View).Show


should probably be

ActiveWorkbook.CustomViews( varView ).Show



---
Regards,
Norman


"gary_wyman" wrote in message
...
I have a simple macro to show custom views that are launched by a combo
box.
It works fine on my computer, but crashes sporadically on other people's
machines in the office. We work on a shared network drive. Any ideas?
Here's my code:
Private Sub Markets_Change()
Dim varView As String
View = ActiveSheet.Range("b2")
ActiveWorkbook.CustomViews(View).Show
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
Program won't work on all computers [email protected] Excel Programming 3 November 8th 06 09:34 PM
Why does copy after worksheets command not work on some computers IanRC Excel Programming 4 February 17th 06 03:30 PM
How do I work out people's exact ages from their Dates of Birth? krakowba Excel Discussion (Misc queries) 6 January 20th 06 05:42 PM
How can I link excel spreadsheets that work on other computers Bob Excel Discussion (Misc queries) 1 May 16th 05 06:33 AM
Formula won't work on some computers Steph[_3_] Excel Programming 2 March 3rd 05 06:08 PM


All times are GMT +1. The time now is 11:39 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"