Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Windows().activate generating obj reqd msg why?

Why do i get object required error message? I have a workbook open
(called FltSchedFileToOpen) and when I use the code below I get an
object reqd error message run-time error 424. Is Excel not sure what
workbook I'm talking about maybe? (This error has perplexed me in the
past.)


Windows(FltSchedFileToOpen.name).Activate
Sheets(1).Copy After:=Workbooks(savename).Sheets(4)

where FltSchedFileToOpen equals C:\Documents and Settings\fdxuser\My
Documents\Flight Schedule\2006-08 Flt
Sched\2006-08_OAK_flt_sched_prelim_raw05-20-06_analyzed.xls

The reason I am using the name command also is because the variable
FltSchedFileToOpen includes the path and I don't think I need that when
I'm using the Windows().activate command.

Thanks,
Chet

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Windows().activate generating obj reqd msg why?

FltSchedFileToOpen is just plain old text--it's not a variable that represents a
workbook.

But you could change that...

Dim FltSchedWkbk as workbook
dim FltSchedFileToOpen as string

FltSchedFileToOpen = "howeveryou set that thing"

set fltschdwkbk = workbooks.open(filename:=FltSchedFileToOpen)

'then you don't have to activate windows.

fFltSchedWkbk.worksheets(1).copy _
after:=workbooks(savename).sheets(4)

======
If you get really industrious, you could create a variable that represents that
savename workbook, too.

Chet wrote:

Why do i get object required error message? I have a workbook open
(called FltSchedFileToOpen) and when I use the code below I get an
object reqd error message run-time error 424. Is Excel not sure what
workbook I'm talking about maybe? (This error has perplexed me in the
past.)

Windows(FltSchedFileToOpen.name).Activate
Sheets(1).Copy After:=Workbooks(savename).Sheets(4)

where FltSchedFileToOpen equals C:\Documents and Settings\fdxuser\My
Documents\Flight Schedule\2006-08 Flt
Sched\2006-08_OAK_flt_sched_prelim_raw05-20-06_analyzed.xls

The reason I am using the name command also is because the variable
FltSchedFileToOpen includes the path and I don't think I need that when
I'm using the Windows().activate command.

Thanks,
Chet


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 88
Default Windows().activate generating obj reqd msg why?

Thanks Dave.... you made my day again!.. Chet

Dave Peterson wrote:
FltSchedFileToOpen is just plain old text--it's not a variable that represents a
workbook.

But you could change that...

Dim FltSchedWkbk as workbook
dim FltSchedFileToOpen as string

FltSchedFileToOpen = "howeveryou set that thing"

set fltschdwkbk = workbooks.open(filename:=FltSchedFileToOpen)

'then you don't have to activate windows.

fFltSchedWkbk.worksheets(1).copy _
after:=workbooks(savename).sheets(4)

======
If you get really industrious, you could create a variable that represents that
savename workbook, too.

Chet wrote:

Why do i get object required error message? I have a workbook open
(called FltSchedFileToOpen) and when I use the code below I get an
object reqd error message run-time error 424. Is Excel not sure what
workbook I'm talking about maybe? (This error has perplexed me in the
past.)

Windows(FltSchedFileToOpen.name).Activate
Sheets(1).Copy After:=Workbooks(savename).Sheets(4)

where FltSchedFileToOpen equals C:\Documents and Settings\fdxuser\My
Documents\Flight Schedule\2006-08 Flt
Sched\2006-08_OAK_flt_sched_prelim_raw05-20-06_analyzed.xls

The reason I am using the name command also is because the variable
FltSchedFileToOpen includes the path and I don't think I need that when
I'm using the Windows().activate command.

Thanks,
Chet


--

Dave Peterson


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
Improve 'Windows(workbook.xls).Activate" statement Hank[_6_] Excel Programming 1 May 2nd 06 02:57 PM
I have no idea why this is giving me a error: Windows(dataFile).Activate madlinux Excel Programming 1 April 19th 05 07:39 AM
Reference to a variable in windows(???).Activate John Baker Excel Programming 7 July 13th 04 02:04 PM
formula help reqd please paul thomas Excel Programming 1 June 18th 04 10:55 AM
using array with Windows().activate NikkoW Excel Programming 1 May 4th 04 03:15 AM


All times are GMT +1. The time now is 11:43 PM.

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"