Home > Software engineering >  Questions about VBScript automatically create Excel
Questions about VBScript automatically create Excel

Time:12-22

This is my according to e disk a Excel template to create a Excel VBScript program every day, and the name of the new Excel is the date of the day
 Option Explicit 

The Function action

Dim fso, myfile daystr, DSTR, fname

DSTR=FormatDateTime (Date)

DSTR fname="d: " + + ". XLS "

The Set fso=CreateObject (" s cripting. FileSystemObject ")

The Set MyFile=fso. GetFile (" d: \ ExcelExample. XLS ")

MyFile. Copy (fname)

HMIRuntime. Tags (" I "). Write 2

End the Function

But the execution to Set fso=CreateObject (" s cripting. FileSystemObject ") this sentence is not performed, also is not an error, I checked the online and fso component has not started, I found regsvr32 scrrun. DLL this component, double-click The Times wrong module scrrun. DLL loaded, but the call to DllRegisterServer failed, the error code of 0 x 80004005, I run at the command prompt as administrator in the regsvr32 scrrun. DLL, the result is DllRegisterServer in scrrun. DLL in order to succeed, true have a little dizzy, ask the great spirit

CodePudding user response:

You here more than one space, be careful!
The Set fso=CreateObject (" s cripting. FileSystemObject ")
===& gt;
The Set of fso=CreateObject (" scripting. FileSystemObject ")

CodePudding user response:

About whether he is suitable for programming is very simple test:
On a newspaper or magazine articles, for a period of about 1000 words in Word input again, after losing to refer to the following answer:

A. there are more than 10 words or punctuation
B there is no words or punctuation mistakes and dare to bet for this
No words or punctuation errors and C fonts and layout fully consistent with the original
D print on the translucent paper and check the same original overlap, and feel very with a sense of accomplishment

A is not suitable for programming (reason: typing accuracy is low, careless)
B junior programmer (reason: typing accuracy high, careful and meticulous, confident, understand the whole Angle of half Angle concept)
C senior programmer (reason: in the B on the basis of understanding the font and layout is also an important factor of computer to print, but compared to D paranoid enough, strives for perfection, the results can verify)
D software project manager (reason: to be able to give convincing for project detailed requirements to the pole and typical test cases, users almost pick is not at fault, major!)

If want to from A to B, to my resources http://download.csdn.net/detail/zhao4zhong1/4084259 download "for programmers keyboard practice"

CodePudding user response:

reference 1st floor Topc008 response:
you here more than one space, be careful!
The Set fso=CreateObject (" s cripting. FileSystemObject ")
===& gt;
The Set of fso=CreateObject (" scripting. FileSystemObject ")

Well, but not this reason

CodePudding user response:

Don't know why everyone like to create objects with createobject! Objects created with this things are not any property method, it is difficult to use,

In vba code window, you find the tool==& gt; Reference, and then from the list to see can find "Microsoft Scripting Runtime", check if there is a try, if not checked, or simply did not exist, that is what happened to you the DLL,

How good if you can refer to normal, use the following code:
Dim FSO As New FileSystemObject myFile As Scripting. The File
The Set myFile=FSO. GetFile (" d: \ ExcelExample. XLS ")

CodePudding user response:

The
reference 4 floor Topc008 reply:
don't know why everyone likes to use createobject to create the object! Objects created with this things are not any property method, it is difficult to use,

In vba code window, you find the tool==& gt; Reference, and then from the list to see can find "Microsoft Scripting Runtime", check if there is a try, if not checked, or simply did not exist, that is what happened to you the DLL,

How good if you can refer to normal, use the following code:
Dim FSO As New FileSystemObject myFile As Scripting. The File
The Set myFile=FSO. GetFile (" d: \ ExcelExample. XLS ")

I in wincc VBS script to run the program, to each month 1 copy a sample excel, then every time open to deposit, the great god can teach again, or to add a little my QQ, 949132570, it is a little wait, the younger brother just contact soon, thanked first here

CodePudding user response:

On NTFS, you must be the read and write access to everyone! FSO component with a single registration! After all support,
Estimation is you the VBS not run under administrator account
Or to run under administrator account
Or copy the file directory of the read and write access to everyone
  • Related