Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
compile error method or data not fount
I want to double check that the user has the right file open before he does
the save. Do I have to do the path for the filename since the active workbook should be open already since there is another process previous. I just want to double check he has the right file since it saves it as a text file. I get a compile error on the first if. Thanks, Private Sub saveIndesign() 'Appends date to filename so as to not write over an existing file ' saveIndesign Macro Const fPath As String = "Mac OS X:" Const fName As String = "Indesign" Const fName1 As String = "SSP" 'do the save first as a txt file If ActiveWorkbook.Filename = "Book1.xls" Then ActiveWorkbook.SaveAs Filename:=fPath & fName & Format(Now, "yyyymmdd_hhmmss") & ".txt" ActiveWorkbook.Close 'then save as a normal workbook or the existing file will be changed to a text file which is not what you want ActiveWorkbook.SaveAs Filename:=fPath & fName1 & Format(Now, "yyyymmdd_hhmmss") & ".xls", FileFormat:=xlWorkbookNormal MsgBox "2 Files Saved " & fName & fPath & Format(Now, "yyyymmdd_hhmmss") & ".txt " & fName1 & fPath & Format(Now, "yyyymmdd_hhmmss") & ".xls" Else MsgBox "Please select the raw SSP file Book1.xls." End If End Sub |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
compile error method or data not fount
That compiles for me... The one thing you should check is that your project
has all of the nnecessary references. In the VBE select Tools - References and look for anything checked but tagged "Missing:". When you are missing references you will get compile errors on otherwise perfectly good code... -- HTH... Jim Thomlinson "Janis" wrote: I want to double check that the user has the right file open before he does the save. Do I have to do the path for the filename since the active workbook should be open already since there is another process previous. I just want to double check he has the right file since it saves it as a text file. I get a compile error on the first if. Thanks, Private Sub saveIndesign() 'Appends date to filename so as to not write over an existing file ' saveIndesign Macro Const fPath As String = "Mac OS X:" Const fName As String = "Indesign" Const fName1 As String = "SSP" 'do the save first as a txt file If ActiveWorkbook.Filename = "Book1.xls" Then ActiveWorkbook.SaveAs Filename:=fPath & fName & Format(Now, "yyyymmdd_hhmmss") & ".txt" ActiveWorkbook.Close 'then save as a normal workbook or the existing file will be changed to a text file which is not what you want ActiveWorkbook.SaveAs Filename:=fPath & fName1 & Format(Now, "yyyymmdd_hhmmss") & ".xls", FileFormat:=xlWorkbookNormal MsgBox "2 Files Saved " & fName & fPath & Format(Now, "yyyymmdd_hhmmss") & ".txt " & fName1 & fPath & Format(Now, "yyyymmdd_hhmmss") & ".xls" Else MsgBox "Please select the raw SSP file Book1.xls." End If End Sub |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
compile error method or data not fount
thanks, Idon't know what the VBE select tools is but I'll look for them,
"Jim Thomlinson" wrote: That compiles for me... The one thing you should check is that your project has all of the nnecessary references. In the VBE select Tools - References and look for anything checked but tagged "Missing:". When you are missing references you will get compile errors on otherwise perfectly good code... -- HTH... Jim Thomlinson "Janis" wrote: I want to double check that the user has the right file open before he does the save. Do I have to do the path for the filename since the active workbook should be open already since there is another process previous. I just want to double check he has the right file since it saves it as a text file. I get a compile error on the first if. Thanks, Private Sub saveIndesign() 'Appends date to filename so as to not write over an existing file ' saveIndesign Macro Const fPath As String = "Mac OS X:" Const fName As String = "Indesign" Const fName1 As String = "SSP" 'do the save first as a txt file If ActiveWorkbook.Filename = "Book1.xls" Then ActiveWorkbook.SaveAs Filename:=fPath & fName & Format(Now, "yyyymmdd_hhmmss") & ".txt" ActiveWorkbook.Close 'then save as a normal workbook or the existing file will be changed to a text file which is not what you want ActiveWorkbook.SaveAs Filename:=fPath & fName1 & Format(Now, "yyyymmdd_hhmmss") & ".xls", FileFormat:=xlWorkbookNormal MsgBox "2 Files Saved " & fName & fPath & Format(Now, "yyyymmdd_hhmmss") & ".txt " & fName1 & fPath & Format(Now, "yyyymmdd_hhmmss") & ".xls" Else MsgBox "Please select the raw SSP file Book1.xls." End If End Sub |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
compile error method or data not fount
In the Visual Basic Explorer (VBE)(the visual basic window) on the menu there
is Tools. From that menu select References... This brings up a dialog that indicates all of the librarys taht the project is using (Librarys are essentialy code modules that you plug into your project in order to gain functionallity. -- HTH... Jim Thomlinson "Janis" wrote: thanks, Idon't know what the VBE select tools is but I'll look for them, "Jim Thomlinson" wrote: That compiles for me... The one thing you should check is that your project has all of the nnecessary references. In the VBE select Tools - References and look for anything checked but tagged "Missing:". When you are missing references you will get compile errors on otherwise perfectly good code... -- HTH... Jim Thomlinson "Janis" wrote: I want to double check that the user has the right file open before he does the save. Do I have to do the path for the filename since the active workbook should be open already since there is another process previous. I just want to double check he has the right file since it saves it as a text file. I get a compile error on the first if. Thanks, Private Sub saveIndesign() 'Appends date to filename so as to not write over an existing file ' saveIndesign Macro Const fPath As String = "Mac OS X:" Const fName As String = "Indesign" Const fName1 As String = "SSP" 'do the save first as a txt file If ActiveWorkbook.Filename = "Book1.xls" Then ActiveWorkbook.SaveAs Filename:=fPath & fName & Format(Now, "yyyymmdd_hhmmss") & ".txt" ActiveWorkbook.Close 'then save as a normal workbook or the existing file will be changed to a text file which is not what you want ActiveWorkbook.SaveAs Filename:=fPath & fName1 & Format(Now, "yyyymmdd_hhmmss") & ".xls", FileFormat:=xlWorkbookNormal MsgBox "2 Files Saved " & fName & fPath & Format(Now, "yyyymmdd_hhmmss") & ".txt " & fName1 & fPath & Format(Now, "yyyymmdd_hhmmss") & ".xls" Else MsgBox "Please select the raw SSP file Book1.xls." End If End Sub |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
compile error method or data not fount
From Excel VBA Help:
VBE Property Returns a VBE object that represents the Visual Basic **Editor** -- Regards, Tom Ogilvy "Jim Thomlinson" wrote in message ... In the Visual Basic Explorer (VBE)(the visual basic window) on the menu there is Tools. From that menu select References... This brings up a dialog that indicates all of the librarys taht the project is using (Librarys are essentialy code modules that you plug into your project in order to gain functionallity. -- HTH... Jim Thomlinson "Janis" wrote: thanks, Idon't know what the VBE select tools is but I'll look for them, "Jim Thomlinson" wrote: That compiles for me... The one thing you should check is that your project has all of the nnecessary references. In the VBE select Tools - References and look for anything checked but tagged "Missing:". When you are missing references you will get compile errors on otherwise perfectly good code... -- HTH... Jim Thomlinson "Janis" wrote: I want to double check that the user has the right file open before he does the save. Do I have to do the path for the filename since the active workbook should be open already since there is another process previous. I just want to double check he has the right file since it saves it as a text file. I get a compile error on the first if. Thanks, Private Sub saveIndesign() 'Appends date to filename so as to not write over an existing file ' saveIndesign Macro Const fPath As String = "Mac OS X:" Const fName As String = "Indesign" Const fName1 As String = "SSP" 'do the save first as a txt file If ActiveWorkbook.Filename = "Book1.xls" Then ActiveWorkbook.SaveAs Filename:=fPath & fName & Format(Now, "yyyymmdd_hhmmss") & ".txt" ActiveWorkbook.Close 'then save as a normal workbook or the existing file will be changed to a text file which is not what you want ActiveWorkbook.SaveAs Filename:=fPath & fName1 & Format(Now, "yyyymmdd_hhmmss") & ".xls", FileFormat:=xlWorkbookNormal MsgBox "2 Files Saved " & fName & fPath & Format(Now, "yyyymmdd_hhmmss") & ".txt " & fName1 & fPath & Format(Now, "yyyymmdd_hhmmss") & ".xls" Else MsgBox "Please select the raw SSP file Book1.xls." End If End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Compile error: Method or data member not found | Excel Worksheet Functions | |||
Compile Error Method or data member not found | Excel Programming | |||
Compile Error: Method or data member not found | Excel Programming | |||
Compile Error: Method or data member not found | Excel Programming | |||
Compile Error: Method or data member not found | Excel Programming |