Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Workbook Open

Hi,

I have the following code in an excel workbook that works fine on m
box running Excel 2000. When I try to open this on a machine runnin
Excel '97 I'm getting a debug error. The Private Sub Workbook_Ope
line is highlighted as well as the Set wb = is highlighted.

Will this code work in Excel '97 or is there some other problem (i.e
access to the other workbook) that I haven't considered. Although th
users that are having the problems should have access to this file.

Thanks in advance.

Jeff

Private Sub Workbook_Open()

Dim Workbook As Workbook
Application.ScreenUpdating = False ' turn off the screen updating
Set wb
Workbooks.Open("\\sfna-fs4\hrs\shared\hr_(all)\accidentflashreport\userfo rmtest.xls"
True, True)
' open the source workbook, read only
With ThisWorkbook.Worksheets("Training")
' read data from the source workbook
.Range("A1:B13").Formula
wb.Worksheets("Sheet3").Range("A1:B13").Formula
End With
With ThisWorkbook.Worksheets("SignUp")
' read data from the source workbook
.Range("A:B").Formula
wb.Worksheets("SignUp").Range("A:B").Formula
End With

wb.Close False ' close the source workbook without saving an
changes
Set wb = Nothing ' free memory
Application.ScreenUpdating = True ' turn on the screen updating

End Su

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Workbook Open

Don't know if this is the problem, but looks like you meant to say "Dim wb
as Workbook." If you've got Option Explicit set in Office 97 (and you
should, cause it catches errors like this) and not in 2000, that might
explain why it runs in 2000 but not in 97.

hth,

Doug Glancy

"muziq2 " wrote in message
...
Hi,

I have the following code in an excel workbook that works fine on my
box running Excel 2000. When I try to open this on a machine running
Excel '97 I'm getting a debug error. The Private Sub Workbook_Open
line is highlighted as well as the Set wb = is highlighted.

Will this code work in Excel '97 or is there some other problem (i.e.
access to the other workbook) that I haven't considered. Although the
users that are having the problems should have access to this file.

Thanks in advance.

Jeff

Private Sub Workbook_Open()

Dim Workbook As Workbook
Application.ScreenUpdating = False ' turn off the screen updating
Set wb =

Workbooks.Open("\\sfna-fs4\hrs\shared\hr_(all)\accidentflashreport\userfo rmt
est.xls",
True, True)
' open the source workbook, read only
With ThisWorkbook.Worksheets("Training")
' read data from the source workbook
Range("A1:B13").Formula =
wb.Worksheets("Sheet3").Range("A1:B13").Formula
End With
With ThisWorkbook.Worksheets("SignUp")
' read data from the source workbook
Range("A:B").Formula =
wb.Worksheets("SignUp").Range("A:B").Formula
End With

wb.Close False ' close the source workbook without saving any
changes
Set wb = Nothing ' free memory
Application.ScreenUpdating = True ' turn on the screen updating

End Sub


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Workbook Open

Thanks. That did solve that error.

Now I'm getting an error on another line that is supposed to ope
Outlook and save add an appointment to the users calendar. The code i
below. The Private Sub cmdSave_Click() is highlighted as well as th
Dim objApp as Outlook.Application.

Also, how would I go about setting Option Explicit in 2000 so I ca
catch these errors on my box?

Thanks in advance for your help.

Jeff

Private Sub cmdSave_Click()

Dim wb As Workbook

Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objAppointment As Outlook.AppointmentItem
Dim s As String, st As String, str As String, stri As String, strin A
String

On Error Resume Next
Set objApp = GetObject(, "Outlook.Application")
If Err.Number Then Set objApp = CreateObject("Outlook.Application")
On Error GoTo

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 770
Default Workbook Open

Jeff,

Sorry, don't know the answer to your Outlook question. You could try
reposting if nobody answers in this thread.

To set Option Explicit in the VBE go to Tools/Options and in the Editor tab
check "Require Variable Declaration."

Doug Glancy

"muziq2 " wrote in message
...
Thanks. That did solve that error.

Now I'm getting an error on another line that is supposed to open
Outlook and save add an appointment to the users calendar. The code is
below. The Private Sub cmdSave_Click() is highlighted as well as the
Dim objApp as Outlook.Application.

Also, how would I go about setting Option Explicit in 2000 so I can
catch these errors on my box?

Thanks in advance for your help.

Jeff

Private Sub cmdSave_Click()

Dim wb As Workbook

Dim objApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Dim objAppointment As Outlook.AppointmentItem
Dim s As String, st As String, str As String, stri As String, strin As
String

On Error Resume Next
Set objApp = GetObject(, "Outlook.Application")
If Err.Number Then Set objApp = CreateObject("Outlook.Application")
On Error GoTo 0


---
Message posted from http://www.ExcelForum.com/



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: Open closed workbook/Search data tables/Return data to open workbook Hugh Adams Excel Discussion (Misc queries) 0 August 18th 10 02:04 PM
Opening Excel, Book1 opens, remains open with other workbook open DanieB Excel Discussion (Misc queries) 0 September 3rd 09 08:23 AM
how do i open a data workbook when i open a timesheet workbook [email protected] uk Excel Discussion (Misc queries) 2 January 4th 09 04:50 PM
excel 2003 saved file will not open without a blank workbook open Bob Excel Discussion (Misc queries) 4 November 11th 06 04:24 PM
Search open sheets in workbook and insert into open sheet punx77 Excel Discussion (Misc queries) 0 March 6th 06 05:07 PM


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