Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Need help with: runtime error '13'

i get a runtime error '13' type mismatch when i run my code. can someone help
me with this code. the code basically opens a file, take info from the file
then close the file. when i click debug part of my code highlighted
"if FName < False Then"

Sub OpenFile()
Declaration.ExitForm
FName = Application.GetOpenFilename(filefilter:="DecProFil e(*.XLS), *.XLS",
Title:="Open Declaration Pro File", MultiSelect:=True)
If FName < False Then

Workbooks.Open (FName.Path & "\" & FName)
If ActiveWorkbook.Worksheets("sheet1").Range("A1").Va lue = "DecProFile" Then
'take info from file
Workbooks("Declaration
Pro.xls").Worksheets("Classification").Range("B5:B 103").Value =
ActiveWorkbook.Worksheets("sheet1").Range("B5:B103 ").Value

ActiveWorkbook.Close
Calculate
Else
MsgBox prompt:="Invalid file", Title:="Invalid"
ActiveWorkbook.Close
End If
End If
End Sub

I appreciate your help
Thank you

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Need help with: runtime error '13'

ok... i tried this and it works with no problem

Sub OpenFile()
Declaration.ExitForm
Dim fname As String, bk As Workbook
fname = Application.GetOpenFilename()
If fname < "False" Then
Set bk = Workbooks.Open(fname)
If ActiveWorkbook.Worksheets("sheet1").Range("A1").Va lue = "DecProFile" Then
'take info from file
Workbooks("Declaration
Pro.xls").Worksheets("Classification").Range("B5:B 103").Value =
ActiveWorkbook.Worksheets("sheet1").Range("B5:B103 ").Value

ActiveWorkbook.Close
Calculate
Else
MsgBox prompt:="Invalid file", Title:="Invalid"
ActiveWorkbook.Close
Declaration.Show vbModeless
End If
Else
Declaration.Show vbModeless
Exit Sub
End If
End Sub


"pape93gyal" wrote:

i get a runtime error '13' type mismatch when i run my code. can someone help
me with this code. the code basically opens a file, take info from the file
then close the file. when i click debug part of my code highlighted
"if FName < False Then"

Sub OpenFile()
Declaration.ExitForm
FName = Application.GetOpenFilename(filefilter:="DecProFil e(*.XLS), *.XLS",
Title:="Open Declaration Pro File", MultiSelect:=True)
If FName < False Then

Workbooks.Open (FName.Path & "\" & FName)
If ActiveWorkbook.Worksheets("sheet1").Range("A1").Va lue = "DecProFile" Then
'take info from file
Workbooks("Declaration
Pro.xls").Worksheets("Classification").Range("B5:B 103").Value =
ActiveWorkbook.Worksheets("sheet1").Range("B5:B103 ").Value

ActiveWorkbook.Close
Calculate
Else
MsgBox prompt:="Invalid file", Title:="Invalid"
ActiveWorkbook.Close
End If
End If
End Sub

I appreciate your help
Thank you

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
xpath error? Runtime Error 13 type mismatch Steve M[_2_] Excel Discussion (Misc queries) 0 January 17th 08 01:16 AM
runtime error: syntax error or access violation oucsester[_2_] Excel Programming 1 May 3rd 06 05:51 PM
Excel 2003 Macro Error - Runtime error 1004 Cow Excel Discussion (Misc queries) 2 June 7th 05 01:40 PM
Syntax Error Runtime Error '424' Object Required sjenks183 Excel Programming 1 January 23rd 04 09:25 AM
Unknown where is the problem on the Runtime error - Automation error wellie Excel Programming 1 July 10th 03 08:12 AM


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