-
May 23rd, 2017, 01:16 AM
#1
Thread Starter
New Member
Microsoft VBScript compilation error: Expected end of statement. What is wrong?
sInput = InputBox("Enter your name")
a=MsgBox 1("You entered: " & sInput , 4+0 , "Is that what you want entered?")
if a = vbyes then
b=msgbox("Yes" , 0+16 , "Yes")
end
-
May 23rd, 2017, 03:46 AM
#2
Re: Microsoft VBScript compilation error: Expected end of statement. What is wrong?
The last line should be "end if" instead of "end"
-
May 23rd, 2017, 12:54 PM
#3
Thread Starter
New Member
Re: Microsoft VBScript compilation error: Expected end of statement. What is wrong?
It still gives me the error
-
May 23rd, 2017, 01:03 PM
#4
Re: Microsoft VBScript compilation error: Expected end of statement. What is wrong?
Remove the 1 before the MsgBox statement
-
May 23rd, 2017, 07:10 PM
#5
Thread Starter
New Member
Re: Microsoft VBScript compilation error: Expected end of statement. What is wrong?
here is the updated code: sInput = InputBox("Enter your name")
Excute a
a=MsgBox("You entered: " & sInput , 4+36 , "Is that what you want entered?")
if a = vbyes then
b=msgbox("Yes" , 0+16 , "Yes")
endif
i now get this error Microsoft VBScript compilation error: Expected statement
-
May 23rd, 2017, 07:11 PM
#6
Thread Starter
New Member
Re: Microsoft VBScript compilation error: Expected end of statement. What is wrong?
i also took out the execute
-
May 24th, 2017, 04:08 AM
#7
Re: Microsoft VBScript compilation error: Expected end of statement. What is wrong?
It should be "end if" not "endif"
-
May 24th, 2017, 08:33 AM
#8
Thread Starter
New Member
Re: Microsoft VBScript compilation error: Expected end of statement. What is wrong?
i got it working! Thanks for all your help.
-
Oct 24th, 2019, 09:15 AM
#9
New Member
Re: Microsoft VBScript compilation error: Expected end of statement. What is wrong?
I have executed the the code as below :
set Path="D:\temp\combined.csv";%PATH%
Sub sbVBS_To_Delete_Multiple_Columns()
Columns("B:U").EntireColumn.Delete
Columns("C:AX").EntireColumn.Delete
End Sub
Sub AddHeaders()
Dim headers() As Variant
Dim ws As Worksheet
Dim wb As Workbook
Application.ScreenUpdating = False 'turn this off for the macro to run a little faster
Set wb = ActiveWorkbook
headers() = Array("Asset Name", "Private IP Address", "Software/Application", "Version", "Vendor", "Role/Purpose", "Location/BU", "Model", "Owner of Asset", "Sensitive Data Type", "Sampled ?", "Syslog Forwarding Support", "Syslog Logging Level", "Asset Value", "DB Version", "Application Version", "WEB Version", "FIM Location", "Log File Location", "Log Storage Method", "Data Store Access Logging", "Agent Type", "Agent Version", "Logging Status", "Appliance Name", "Appliance Status", "Datasource Name", "Datasource Status", "Tags")
For Each ws In wb.Sheets
With ws
.Rows(1).Value = "" 'This will clear out row 1
For i = LBound(headers()) To UBound(headers())
.Cells(1, 1 + i).Value = headers(i)
Next i
.Rows(1).Font.Bold = True
End With
Next ws
Application.ScreenUpdating = True 'turn it back on
MsgBox ("Done!")
End Sub
I am getting compilation error as : 800A401 error
Please let me know what have I done wrong in my code
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|