1

Topic: VBScript. Problems with discovery of a folder from MsgBox

Help  a script? 2 days wrote.  that at button click There is no"in MsgBox it it should be closed, and at pushing"Yes"the directory on the way from a variable f1 should open.

Dim a1, b1, c1, d1, e1, f1, objShell
a1 = RecordsToString (SELECT COUNT (*) FROM qdfMain WHERE ID = <ID> AND ID IN (SELECT ID FROM qdfMain WHERE (TypeClaim LIKE ' 7-10 % ' OR TypeClaim LIKE ' 7-90 % ')))
b1 = RecordsToString (SELECT MAX (TPI) FROM qdfDamage WHERE KI IS NOT NULL AND KI = <KI> AND DamID <<DamID>)
c1 = <TPI>
d1 = RecordsToString (Select KI FROM qdfDamage WHERE DamID = <DamID>)
e1 = (Left (d1, 2) + Right (d1, 2))
f1 = "Old edition HST:" both b1 and vbCrLf and "New edition HST:" both c1 and vbCrLf and vbCrLf and "Add the actual description of action in a folder:" and vbCrLf and "D:\VW DATA\ actions \Aktionen \" both e1 and vbCrLf and vbCrLf and "to Open a folder?"
If a1 = 1 And b1 <> c1 Then
MsgBox (f1, vbYesNo)
Else If MsgBox (f1, vbYesNo) = vbYes Then
Set objShell = CreateObject ("Wscript. Shell")
objShell. Run "f1"
End If

2

Re: VBScript. Problems with discovery of a folder from MsgBox

ypmail wrote:

If MsgBox (f1

ypmail wrote:

objShell. Run "f1"

In the second case you quote a variable, can explain why?
The help on the following step:
The way is stored in a variable f1, judging by the code not.
And still : If you name variables normal made names, your code can be read and analyzed.

3

Re: VBScript. Problems with discovery of a folder from MsgBox

ypmail wrote:

If a1 = 1 And b1 <> c1 Then
MsgBox (f1, vbYesNo)
Else If MsgBox (f1, vbYesNo) = vbYes Then
Set objShell = CreateObject ("Wscript. Shell")
objShell. Run "f1"
End If

And in what sacral sense of call MsgBox in two branches If?
Can it is necessary so (there can be an error since the sense is not clear)?

If MsgBox (f1, vbYesNo) = vbYes and not (a1 = 1 And b1 <> c1) Then
Set objShell = CreateObject ("Wscript. Shell")
objShell. Run "f1"
End If

4

Re: VBScript. Problems with discovery of a folder from MsgBox

And what it for object in file system with a name f1?

Shocker. Pro wrote:

In the second case you quote a variable

If there there should be a variable to try to launch on performance its value - wildness utter.

5

Re: VBScript. Problems with discovery of a folder from MsgBox

HandKot wrote:

can it is necessary so (there can be an error since the sense is not clear)?

If MsgBox (f1, vbYesNo) = vbYes and not (a1 = 1 And b1 <> c1) Then
Set objShell = CreateObject ("Wscript. Shell")
objShell. Run "f1"
End If

More likely so:

If a1 <> 1 Or b1 = c1 Then
If vbYes = MsgBox (f1, vbYesNo) Then
Set objShell = CreateObject ("Wscript. Shell")
objShell. Run "f1"
End If
End If

In your variant MsgBox () it will be caused in the same way without dependence from remaining conditions.

6

Re: VBScript. Problems with discovery of a folder from MsgBox

Thanks, here so work:

Dim a1, b1, c1, d1, e1, f1, objShell
a1 = RecordsToString (SELECT COUNT (*) FROM qdfMain WHERE ID = <ID> AND ID IN (SELECT ID FROM qdfMain WHERE (TypeClaim LIKE ' 7-10 % ' OR TypeClaim LIKE ' 7-90 % ')))
b1 = RecordsToString (SELECT MAX (TPI) FROM qdfDamage WHERE KI IS NOT NULL AND KI = <KI> AND DamID <<DamID>)
c1 = <TPI>
d1 = RecordsToString (Select KI FROM qdfDamage WHERE DamID = <DamID>)
e1 = (Left (d1, 2) + Right (d1, 2))
f1 = "Old edition HST:" both b1 and vbCrLf and "New edition HST:" both c1 and vbCrLf and vbCrLf and "Add the actual description of action in a folder:" and vbCrLf and "D:\VW DATA\ actions \Aktionen \" both e1 and vbCrLf and vbCrLf and "to Open a folder?"
If a1 = 1 And b1 <> c1 Then
If vbYes = MsgBox (f1, vbYesNo) Then
Set objShell = CreateObject ("Wscript. Shell")
objShell. Run "C:\Windows \"
End If
End If

to variables added, since in a piece "D:\VW DATA\ actions \Aktionen \" instead of D for some reason in MsgBox value d was deduced. Therefore added in variables 1 and it began to be deduced normally.
As though now instead of "C:\Windows \" to open a folder which way is shown in message MsgBox?

7

Re: VBScript. Problems with discovery of a folder from MsgBox

ypmail;
objShell. Run "D:\VW DATA\ actions \Aktionen \"

8

Re: VBScript. Problems with discovery of a folder from MsgBox

big-duke wrote:

ypmail;
objShell. Run "D:\VW DATA\ actions \Aktionen \"

still value e1 to this way to add

objShell. Run "D:\VW DATA\ actions \Aktionen \" and e1

Does not work

9

Re: VBScript. Problems with discovery of a folder from MsgBox

10

Re: VBScript. Problems with discovery of a folder from MsgBox

Really in vbs it not to bypass in any way?

11

Re: VBScript. Problems with discovery of a folder from MsgBox

ypmail wrote:

does not work

objShell. Run """D:\VW DATA\ actions \Aktionen \" and e1 and """"

12

Re: VBScript. Problems with discovery of a folder from MsgBox

Akina wrote:

objShell. Run """D:\VW DATA\ actions \Aktionen \" and e1 and """"

Opens a folder "Computer".

13

Re: VBScript. Problems with discovery of a folder from MsgBox

And what in e1, not null hour?

14

Re: VBScript. Problems with discovery of a folder from MsgBox

d1 = RecordsToString (Select KI FROM qdfDamage WHERE DamID = <DamID>)

we Receive value 42 G8

e1 = (Left (d1, 2) + Right (d1, 2))

it is led to its type of a title of a folder 42G8 i.e. that it was without a gap in the middle
MsgBox deduces in the end of 42G8 address without a gap, and I try to stick this value to a constant way further and to open a real-life folder to the address: D:\VW DATA\ actions \Aktionen\42G8

15

Re: VBScript. Problems with discovery of a folder from MsgBox

If to simplify the task and to lead a script to such type:

Dim path, objShell
path = "C:\Program Files"
If vbYes = MsgBox (path, vbYesNo) Then
Set objShell = CreateObject ("Wscript. Shell")
objShell. Run path
End If

objShell. Run path - does not work
objShell. Run "" and path and "" - does not work
How correctly to write down folder discovery on the way, specified in a variable?

16

Re: VBScript. Problems with discovery of a folder from MsgBox

ypmail wrote:

objShell. Run "" and path and "" - does not work

Inverted commas should be on 4. Or instead of them to interpose explicitly CHR (34).
Also it is necessary to be convinced that  for a folder it is not thrown from an explorer somewhere else... As a last resort explicitly to launch it with parameter - folder name.

17

Re: VBScript. Problems with discovery of a folder from MsgBox

Thanks. From a file vbs all works.