Hi,
I am trying to convert some working VBA code to work in VBScript.
The error I am getting is: "VBScript compilation error: Expected end of statement" on the line of code with the Red font.
TIAPlease Login or Register to view this content.
Hi,
I am trying to convert some working VBA code to work in VBScript.
The error I am getting is: "VBScript compilation error: Expected end of statement" on the line of code with the Red font.
TIAPlease Login or Register to view this content.
Last edited by dlow; 11-28-2015 at 01:45 PM.
Hello dlow,
Try this statement...
Please Login or Register to view this content.
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Star below the post.3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
Hi Leith,
Thanks for the reply sadly, I still get the same error: "VBScript compilation error: Expected end of statement"
Heres my full codeModule
Apologizes for the mess I still have to clean the code up.Please Login or Register to view this content.
Oh, I am debugging or testing the code in PrimalScript
Last edited by dlow; 11-28-2015 at 03:04 PM.
I don't think you can use the VBA file I/O methods in VBS, I think you'll need to use the File System Object.
If posting code please use code tags, see here.
Ok thanks I will give that a try.
Thanks Norie.
Try this, which is adapted from some other code and, unfortunately, untested.
Please Login or Register to view this content.
Thanks
The code you provided works in VBA & no errors in VBS, but its not opening the file in VBS, but does in VBA.
Sorry for the late reply. [Had to run an errand & I just got back].
Gonna step through & see if I can find the problem with this code running in VBScript.
What is the code meant to do?
Have you checked file paths and names?
Yikes my script wasnt even firing, beacuse when I added:
to the top of my code & nothing happened.Please Login or Register to view this content.
I removed the Sub & End Sub; the Exits also. Now its firing & Ive got some new errors to fix.
But what I am lost on is why dont I need Sub? Is it that VBS is not modular & we just wouldnt have many Subroutines in a Script.
VBS does use Sub(s) and Function(s).
How are you trying to run the code?
Hi Norie
Didnt see your reply #9
What is the code meant to do?
I have a large file that I want to make sure is open. Because its a large file I am planning to Script it so the task can be ran but the code doesnt wait for the file to open.
While that file is opening if it needs to be opend I would also be running some code that runs about 15 minutes. So if the code doesnt have to wait on the file it all gets done a little faster.
Have you checked file paths and names?
Yeah the path are correct.
It wasnt firing because I had Sub/EndSub & Exit in the Script.
Do you know why Script doesnt need Sub/EndSub?
I can always Google search it if its to much trouble to answer/type in a post.
Last edited by dlow; 11-28-2015 at 06:22 PM.
Ah,
I am running it from PrimalScript
Ok so its working now but Im getting errors on WindowState Property I changed the font to Red on those line.
Please Login or Register to view this content.
The 1st & 2nd error thrown is: Microsoft Excel: Unable to set the WindowState property of the Application class
So I added:
to the top of the code, & changed the code accordingly but I still get an error shown in Red below.Please Login or Register to view this content.
Please Login or Register to view this content.
Changed the constants to:
As per the MSDNPlease Login or Register to view this content.
The code works & runs to the end if I use vbMaximized but if I use vbNormal it gets hung where I try to use it.
Does anyone have any idea how I could fix the error in Red?
Please Login or Register to view this content.
Yet again I bumbled my way though it.
Try this:
Thanks everybody for your help.Please Login or Register to view this content.
You can get the value of constants in the Object Browser, or just in the Immediate window:
Please Login or Register to view this content.
Entia non sunt multiplicanda sine necessitate
No way! lol....
Thanks a lot Shg, Youre the Man
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks