Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
i get this error even after pasting in tried and true code. I am trying to
paste this code in a workbook I got from someone else. I am not sure why it doesn't work (something disabled?) seems like it doesn't like "Visual Basic for Applications" functions. what do i need to do to make this work? THANKS!! |
#2
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
Melanie
When in the VBE go to ToolsReferences and see if any references are marked as missing. You may want to post your code here for trouble-shooting. Gord Dibben MS Excel MVP On Mon, 17 Aug 2009 12:33:01 -0700, Melanie wrote: i get this error even after pasting in tried and true code. I am trying to paste this code in a workbook I got from someone else. I am not sure why it doesn't work (something disabled?) seems like it doesn't like "Visual Basic for Applications" functions. what do i need to do to make this work? THANKS!! |
#3
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
I think I got this from you! It works in one of my other workbooks. Just
not from a workbook I got from someone else. It gives me an error at the "Right" function. If I delete this statement, it stops at the "environ" function. Private Sub Workbook_Open() Dim sFile As String Dim sText Dim ff As Long sFile = Application.DefaultFilePath ' or maybe 'sFile = ThisWorkbook.Path If Right$(sFile, 1) < "\" Then sFile = sFile & "\" sFile = sFile & "logTest.txt" sText = Environ("Username") & vbTab & Format(Now, "yyyy-mm-dd hh:mm:ss") 'Environ("Username") is the login name of user opening the workbook ff = FreeFile Open sFile For Append As #ff Print #ff, sText Close #ff End Sub "Gord Dibben" wrote: Melanie When in the VBE go to ToolsReferences and see if any references are marked as missing. You may want to post your code here for trouble-shooting. Gord Dibben MS Excel MVP On Mon, 17 Aug 2009 12:33:01 -0700, Melanie wrote: i get this error even after pasting in tried and true code. I am trying to paste this code in a workbook I got from someone else. I am not sure why it doesn't work (something disabled?) seems like it doesn't like "Visual Basic for Applications" functions. what do i need to do to make this work? THANKS!! |
#4
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
Did you check for any missing references?
I tested with this line remmed out If Right$(sFile, 1) < "\" Then sFile = sFile & "\" Code still works properly in my setup............from any workbook opened from any folder. You are saying that when you delete that line you get an error at sText = Environ("Username") & vbTab & Format(Now, "yyyy-mm-dd hh:mm:ss") Gord On Tue, 18 Aug 2009 06:09:16 -0700, Melanie wrote: I think I got this from you! It works in one of my other workbooks. Just not from a workbook I got from someone else. It gives me an error at the "Right" function. If I delete this statement, it stops at the "environ" function. Private Sub Workbook_Open() Dim sFile As String Dim sText Dim ff As Long sFile = Application.DefaultFilePath ' or maybe 'sFile = ThisWorkbook.Path If Right$(sFile, 1) < "\" Then sFile = sFile & "\" sFile = sFile & "logTest.txt" sText = Environ("Username") & vbTab & Format(Now, "yyyy-mm-dd hh:mm:ss") 'Environ("Username") is the login name of user opening the workbook ff = FreeFile Open sFile For Append As #ff Print #ff, sText Close #ff End Sub "Gord Dibben" wrote: Melanie When in the VBE go to ToolsReferences and see if any references are marked as missing. You may want to post your code here for trouble-shooting. Gord Dibben MS Excel MVP On Mon, 17 Aug 2009 12:33:01 -0700, Melanie wrote: i get this error even after pasting in tried and true code. I am trying to paste this code in a workbook I got from someone else. I am not sure why it doesn't work (something disabled?) seems like it doesn't like "Visual Basic for Applications" functions. what do i need to do to make this work? THANKS!! |
#5
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
I misspoke.
If I rem out the line If Right$(sFile, 1) < "\" Then sFile = sFile & "\" The code does nothing.............no error, just nothing. Gord On Tue, 18 Aug 2009 07:13:00 -0700, Gord Dibben <gorddibbATshawDOTca wrote: Did you check for any missing references? I tested with this line remmed out If Right$(sFile, 1) < "\" Then sFile = sFile & "\" Code still works properly in my setup............from any workbook opened from any folder. You are saying that when you delete that line you get an error at sText = Environ("Username") & vbTab & Format(Now, "yyyy-mm-dd hh:mm:ss") Gord On Tue, 18 Aug 2009 06:09:16 -0700, Melanie wrote: I think I got this from you! It works in one of my other workbooks. Just not from a workbook I got from someone else. It gives me an error at the "Right" function. If I delete this statement, it stops at the "environ" function. Private Sub Workbook_Open() Dim sFile As String Dim sText Dim ff As Long sFile = Application.DefaultFilePath ' or maybe 'sFile = ThisWorkbook.Path If Right$(sFile, 1) < "\" Then sFile = sFile & "\" sFile = sFile & "logTest.txt" sText = Environ("Username") & vbTab & Format(Now, "yyyy-mm-dd hh:mm:ss") 'Environ("Username") is the login name of user opening the workbook ff = FreeFile Open sFile For Append As #ff Print #ff, sText Close #ff End Sub "Gord Dibben" wrote: Melanie When in the VBE go to ToolsReferences and see if any references are marked as missing. You may want to post your code here for trouble-shooting. Gord Dibben MS Excel MVP On Mon, 17 Aug 2009 12:33:01 -0700, Melanie wrote: i get this error even after pasting in tried and true code. I am trying to paste this code in a workbook I got from someone else. I am not sure why it doesn't work (something disabled?) seems like it doesn't like "Visual Basic for Applications" functions. what do i need to do to make this work? THANKS!! |
#6
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]() I checked and yes there was a missing library. I unchecked it because I don't think it is important for my purposes. Now I get an error at the FORMAT statement saying that it has "wrong number of arguments or invalid property assignment" "Gord Dibben" wrote: Did you check for any missing references? I tested with this line remmed out If Right$(sFile, 1) < "\" Then sFile = sFile & "\" Code still works properly in my setup............from any workbook opened from any folder. You are saying that when you delete that line you get an error at sText = Environ("Username") & vbTab & Format(Now, "yyyy-mm-dd hh:mm:ss") Gord On Tue, 18 Aug 2009 06:09:16 -0700, Melanie wrote: I think I got this from you! It works in one of my other workbooks. Just not from a workbook I got from someone else. It gives me an error at the "Right" function. If I delete this statement, it stops at the "environ" function. Private Sub Workbook_Open() Dim sFile As String Dim sText Dim ff As Long sFile = Application.DefaultFilePath ' or maybe 'sFile = ThisWorkbook.Path If Right$(sFile, 1) < "\" Then sFile = sFile & "\" sFile = sFile & "logTest.txt" sText = Environ("Username") & vbTab & Format(Now, "yyyy-mm-dd hh:mm:ss") 'Environ("Username") is the login name of user opening the workbook ff = FreeFile Open sFile For Append As #ff Print #ff, sText Close #ff End Sub "Gord Dibben" wrote: Melanie When in the VBE go to ToolsReferences and see if any references are marked as missing. You may want to post your code here for trouble-shooting. Gord Dibben MS Excel MVP On Mon, 17 Aug 2009 12:33:01 -0700, Melanie wrote: i get this error even after pasting in tried and true code. I am trying to paste this code in a workbook I got from someone else. I am not sure why it doesn't work (something disabled?) seems like it doesn't like "Visual Basic for Applications" functions. what do i need to do to make this work? THANKS!! |
#7
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]() I checked and yes there was a missing library. I unchecked it because I don't think it is important for my purposes. Now I get an error at the FORMAT statement saying that it has "wrong number of arguments or invalid property assignment" |
#8
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
I assume you have copied the code directly from the posting and have no
typos. sText = Environ("Username") & vbTab & Format(Now, "yyyy-mm-dd hh:mm:ss") Try experimenting with either of these................. sText = Application.UserName & vbTab & Format(Now, "yyyy-mm-dd hh:mm:ss") sText = "hoohah" & vbTab & Format(Now, "yyyy-mm-dd hh:mm:ss") If you wish, you could email the workbook to me. gorddibbATshawDOTca Change the AT and DOT Gord On Tue, 18 Aug 2009 07:50:01 -0700, Melanie wrote: I checked and yes there was a missing library. I unchecked it because I don't think it is important for my purposes. Now I get an error at the FORMAT statement saying that it has "wrong number of arguments or invalid property assignment" |
#9
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
i tried both and they still don't work with the same compile error.
i'm pretty sure it has something to do with the workbook... there are no typos in my code. unfortunately i can't send this workbook as it's work-confidential. :( oooh well... thanks anyway. |
#10
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
I should add that if I delete the Format command, it works (but no date)
|
#11
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
I thought you said you got rid of the comile error by checking a missing
reference? Gord On Tue, 18 Aug 2009 10:27:01 -0700, Melanie wrote: i tried both and they still don't work with the same compile error. i'm pretty sure it has something to do with the workbook... there are no typos in my code. unfortunately i can't send this workbook as it's work-confidential. :( oooh well... thanks anyway. |
#12
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
That I don't understand.
If no typos, Format(Now, "yyyy-mm-dd hh:mm:ss") should work properly. You do get the logtest.txt file created and the appending of Username works each time you open the workbook? Something we're missing but I can't put my finger on it. Maybe someone else can see the fault? Gord On Tue, 18 Aug 2009 10:30:01 -0700, Melanie wrote: I should add that if I delete the Format command, it works (but no date) |
#13
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
maybe the Excel workbook is down rev?
even though the Visual Basic for Applications is checked off in the 'References' section, for some reason maybe it isn't there?? i don't know... it's strange because the code works in my other workbooks. just not this one. |
#14
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
Which version of Excel are you running?
Make a copy of the workbook. Delete the sheets with sensitive information. Save the new workbook in any version and send to me. gorddibbATshawDOTca Gord On Tue, 18 Aug 2009 12:03:01 -0700, Melanie wrote: maybe the Excel workbook is down rev? even though the Visual Basic for Applications is checked off in the 'References' section, for some reason maybe it isn't there?? i don't know... it's strange because the code works in my other workbooks. just not this one. |
#15
![]()
Posted to microsoft.public.excel.newusers
|
|||
|
|||
![]()
For the edification of anyone who was follwing this thread..............
Melanie sent me the workbook.....scaled down. The problem with the Format statement was that she had a module with some macros. One of them was Sub Format() Excel barfed on this until I changed the name to Format22 All is well. Gord On Tue, 18 Aug 2009 10:47:57 -0700, Gord Dibben <gorddibbATshawDOTca wrote: That I don't understand. If no typos, Format(Now, "yyyy-mm-dd hh:mm:ss") should work properly. You do get the logtest.txt file created and the appending of Username works each time you open the workbook? Something we're missing but I can't put my finger on it. Maybe someone else can see the fault? Gord On Tue, 18 Aug 2009 10:30:01 -0700, Melanie wrote: I should add that if I delete the Format command, it works (but no date) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Can't Find Project or Library Error | Excel Discussion (Misc queries) | |||
Excell error "Can't find Project or Library" Project VBAProject | Excel Worksheet Functions | |||
can't find project or library - error | New Users to Excel | |||
help with this error-Compile error: cant find project or library | Excel Discussion (Misc queries) | |||
microsoft visual basic compile error can't find library | Setting up and Configuration of Excel |