Page 1 of 1
Need Help with VB in Excel
Posted: Fri Feb 13, 2015 7:06 pm
by Tzahrkiya
Hey folks, this is a long shot but I`m wondering if theres anyone on the forums that knows there way around visual basic to help me try to fix an error...
long story short - found an excel macro which takes a song in wav format and converts it to be used as a stereostim track.
problem - when I click on the box to open select a song I get an error stating compile error couldnt find project or library (this happens as soon as i click the box I dont get an option to select a file)
now having google`d extensively I have been unable to find a solution but I am assuming I am missing a component of VB, however I have no idea how to check or install them :-s
could anyone offer some assistance?
thanks
Re: Need Help with VB in Excel
Posted: Fri Feb 13, 2015 8:17 pm
by kakarot
in vba editor tools -> references, you probably need to check one of those libraries, not sure which one though,
but since it happens when trying to do a file pick dialog, probably one of the Microsoft libraries, some Microsoft item picker or something.
i think there will be something marked as missing, that could help in finding the culprit
Re: Need Help with VB in Excel
Posted: Fri Feb 13, 2015 8:40 pm
by Tzahrkiya
I did eventually find the missing library and got it installed...
however the macro is giving out runtime errors
http://www.mediafire.com/download/zw3zq ... c2Stim.rar
if anyone wants to have a look at it.. it is somthing I`d love to get working
rar file contains
excel sheet
source code
manual
dll of the library i was missing
Tz
Re: Need Help with VB in Excel
Posted: Sat Feb 14, 2015 12:43 pm
by Aardvark13
Seemed to work Ok for me.
What was the error ? and what did you do to get the error ?
Re: Need Help with VB in Excel
Posted: Sat Feb 14, 2015 7:51 pm
by Tzahrkiya
I load the sheet up, I click on load file, i get the open file window so I select a test wav file I created. It loads the files as you can see it counting from 0 to 100% then I get a runtime error.
run-time error '-2147467259 (80004005)':
Method 'SetSourceData- of object'_Chart' failed
The debugger points to this line
Worksheets("Music2Stim").ChartObjects(1).Chart.SetSourceData Worksheets("work").Range(hi$), xlcolums
thanks for taking the time to look Aardvark13 :)
Re: Need Help with VB in Excel
Posted: Sun Feb 15, 2015 12:01 pm
by Aardvark13
OK, I think the reason you are gettng errors is due to the WAV file that you are using. Try downloading this file
http://www.nch.com.au/acm/11k16bitpcm.wav
and using that as your input file.
If that works then it is likely an issue with your input file.
Technical Bit.
The reason it fails on that line is the range(hi$) part - basically Hi$ isn't storing the correct value and it screws up the chart object. If you look on the work tab in Excel, there should be 3 columns of data if the macro is working - if there are no columns you will get the error.
I'm not sure what your file is and according to the manual it should take CD format (44kHZ 16 bit Stereo). But I had issues with a CD track I'd ripped to WAV using Windows media player. It wouldn't even start the process, but skipping the line in the macro where it stopped I got the error on the line you mentioned.
I then used VLC player (which didn't play the media player ripped track) to convert the file to Audio CD format. This file worked as input in the Excel file with no issues - so maybe you could try this with your input file.
Re: Need Help with VB in Excel
Posted: Sun Feb 15, 2015 5:32 pm
by Tzahrkiya
Hey Aardvark13
thanks for really having a look at this. I couldnt download the wav you posted as I dont have quicktime but I did use audioconverter to try changing the file I was using to 11k16bit, also tried using vlc to convert to cd quality aswell still to no avail. Also tried a diferent file aswell various times :(
I still get the same error, even though all 3 lines in the work sheet are populated the error still persists..
guess it just doesnt want to work for me :(
again thanks for trying, much appreciated.
Re: Need Help with VB in Excel
Posted: Tue Feb 17, 2015 4:19 pm
by Aardvark13
You don't need quicktime to download the file, just right click on the link and choose save as and save the file somewhere on your PC.
Or, if you upload your file somewhere and give me a link so I can download it, I can try and see if it works with your file or not.
Re: Need Help with VB in Excel
Posted: Tue Feb 17, 2015 6:24 pm
by Tzahrkiya
I still get the same error with your file :(
Re: Need Help with VB in Excel
Posted: Tue Feb 17, 2015 6:43 pm
by Aardvark13
Ok.
Try deleting all the data from the 'work' tab and running it again.
Assuming it gives an error on the same line, go into the debugger, hover over the hi$ and see what it's value is, it should be in the format A1:C2000 (the 2000 may be different for you.)
Also, try changing xlcolums to xlcolumns (xlcolums is a typo). This didn't give me an error, but it is wrong so might help.
Re: Need Help with VB in Excel
Posted: Tue Feb 17, 2015 10:18 pm
by Tzahrkiya
Re: Need Help with VB in Excel
Posted: Tue Feb 17, 2015 10:56 pm
by Aardvark13
No problem. Glad I could help. Bit annoyed that i missed the typo on that line, but it worked fine with the error for me. That's computers I suppose.