Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Runtime error 424 - Object required


Hello

I am getting the Runtime 424 error with the code below. I am a newbie
and have looked at help but cannot understand how I can modify the code
below to give me what I wana do.

Purpose of the code:

User selects a file-Open the file-copy over A10 to A10 of the source
file

Thanks in advance :)



Sub test()

Dim file_open As Variant

file_open = Application.GetOpenFilename("Excel Files (*.xls),
*.xls")

Workbooks.Open Filename:=file_open

' open the source workbook, read only
With ThisWorkbook.Worksheets("Sheet1")
' read data from the source workbook
..Range("A10").Formula =
file_open.Worksheets("PM").Range("A10").Formula


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


--
periro16
------------------------------------------------------------------------
periro16's Profile: http://www.excelforum.com/member.php...o&userid=26345
View this thread: http://www.excelforum.com/showthread...hreadid=469533

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Runtime error 424 - Object required

Give this a try...

Sub test()

Dim file_open As Variant
Dim wbkDestination as workbook

file_open = Application.GetOpenFilename("Excel Files (*.xls),
*.xls")

Workbooks.Open Filename:=file_open
set wbkDestination = Activeworkbook
' open the source workbook, read only
With ThisWorkbook.Worksheets("Sheet1")
' read data from the source workbook
..Range("A10").Formula =
wbkDestination.Worksheets("PM").Range("A10").Formu la


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

--
HTH...

Jim Thomlinson


"periro16" wrote:


Hello

I am getting the Runtime 424 error with the code below. I am a newbie
and have looked at help but cannot understand how I can modify the code
below to give me what I wana do.

Purpose of the code:

User selects a file-Open the file-copy over A10 to A10 of the source
file

Thanks in advance :)



Sub test()

Dim file_open As Variant

file_open = Application.GetOpenFilename("Excel Files (*.xls),
*.xls")

Workbooks.Open Filename:=file_open

' open the source workbook, read only
With ThisWorkbook.Worksheets("Sheet1")
' read data from the source workbook
.Range("A10").Formula =
file_open.Worksheets("PM").Range("A10").Formula


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


--
periro16
------------------------------------------------------------------------
periro16's Profile: http://www.excelforum.com/member.php...o&userid=26345
View this thread: http://www.excelforum.com/showthread...hreadid=469533


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
Runtime error '424': Object Required loren.pottinger Excel Discussion (Misc queries) 1 August 28th 06 09:56 PM
"Microsoft Visual Basic runtime error '424' object required". SharonG. Excel Worksheet Functions 0 July 5th 06 01:36 AM
RUNTIME 424 OBJECT REQUIRED??? -JEFF-[_2_] Excel Programming 2 June 17th 05 01:26 PM
runtime error ....object required mlm Excel Programming 3 February 18th 04 06:09 PM
Syntax Error Runtime Error '424' Object Required sjenks183 Excel Programming 1 January 23rd 04 09:25 AM


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