[Webinar] Streamline your web hosting managementRegister Today

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 80
  • Last Modified:

VBS file using code from 2nd file (txt or vbs)

Hi everyone, I need to include some code on hundreds of files so I would like to be able to keep a separate file that will hold all of the settings for these files so they can easily be changed at a later time.

If I take the contents exactly as is from the EMAILSETTINGS.VBS file & I paste them in the EMAILIT.VBS file everything works perfectly, but it wont use the code when I point to it as an included file. I've been able to pass the data as a variable into the main app & msgBox it, but I cant get EMAILIT.VBS to actually parse it as code.

Thanks in advance.
JD
EmailIt.vbs
EmailSettings.vbs
0
Jon DeVito
Asked:
Jon DeVito
  • 2
  • 2
1 Solution
 
MacroShadowCommented:
Please try this (not tested):
Set fs = CreateObject("Scripting.FileSystemObject")
Set ts = fs.OpenTextFile("EmailSettings.vbs")
Execute ts.ReadAll
ts.Close

Open in new window

0
 
Jon DeVitoAuthor Commented:
Awesome, thanks for the help!
0
 
MacroShadowCommented:
Glad it worked :)
0
 
Jon DeVitoAuthor Commented:
I tried something very similar but I wasn't putting it all within the With section. I was putting the Set statements together at the top & the Execute within the With trying to keep it nice & clean but it didn't work. Thanks again for the help.
0

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now