Error While Running VBA

mohd_arastu

New Member
Joined
Feb 21, 2012
Messages
19
Dear Friends

I wrote a VBA a code for design of RAFT foundation.

All things are going well.

But when i run VBA then, on desktop it create a file with name ERROR.

i m not able to resolve this.

can anyone help me to solve this problem?

thanks
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Please post your VBA code, and tells us on which line the error is occurring (if you hit "Debug", it usually highlights the offending line).
 
Upvote 0
Sub CHECK_STAAD_RESULTS()
Application.ScreenUpdating = False

Dim start_time, end_time
start_time = Now()

Dim xlApp As Excel.Application
Dim xlWB As Excel.Workbook
Dim STAADFileName As String
Dim objOpenSTAAD As Output
Set objOpenSTAAD = CreateObject("OpenSTAAD.Output.1")
STAADFileName = Sheet1.Range("B5").Value
objOpenSTAAD.SelectSTAADFile STAADFileName

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim pnResult As Integer
objOpenSTAAD.AreResultsAvailable STAADFileName, pnResult
Sheet1.Range("B15") = pnResult
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
objOpenSTAAD.CloseSTAADFile
Set objOpenSTAAD = Nothing
Set xlWB = Nothing
Set xlApp = Nothing
'Application.ScreenUpdating = True

end_time = Now()
Sheet8.Range("B10").Value = DateDiff("s", start_time, end_time)


End Sub
 
Upvote 0
It looks like this variable is setting your file name:
Code:
STAADFileName = Sheet1.Range("B5").Value
So what exactly is in range B5 on sheet1?
Maybe you have some characters which you cannot use in file names.
 
Upvote 0
That seems to look OK.

Are you using some special VBA references, libraries, or add-ins? I think you must be, because I get errors when I try to compile your code in Excel VBA.
 
Upvote 0
I do not see that as an option in my list.
I take it this might be a reference you pruchased/installed?
If so, I am afraid that I cannot test it out, so I do not have access to it.
 
Upvote 0
yes i installed a software STAAD PRO 2007 in my PC. it is a software for analysis of buildings.

My VBA code check whether the analysis has been performed or not.

if pnResult value = 1 then it means that the analysis performed
and if pnResult value = 0 then it means that the analysis is not performed.
 
Upvote 0
I am afraid there is not going to be much I can do for you, since I do not have that program.

I would recommend stepping through your code one line at a time (using the F8 key). You can then what it is doing at each step, and if you hover over your variables in your VBA code as you pass that line, it will show you what their values are. That might give you some clue as to where the problem is occurring.
 
Upvote 0

Forum statistics

Threads
1,215,417
Messages
6,124,789
Members
449,188
Latest member
Hoffk036

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top