Referencing sheet on a web browser

J

jeq214

I have a sheet that calculates pricing projections which gets its info from a
form that pops up when the user clicks a button. The file is posted on the
intranet and works fine when it is saved on to the desktop. The problem
occurs when the user selects 'Open' and the file is opened in a web browser.
I get a "Run-time error '91': Object variable or With block variable not set"
error on the fifth line:

Private Sub cmdCalc_Click()
Dim vEmpty As String
Dim vNumeric As String

ActiveWorkbook.Sheets("Business Account Pricing").Activate <-------
Range("A1").Select

' Check user input

If Me.txtECR.Value = "" Then
vEmpty = Chr(149) & " Earnings Credit Rate" & vbNewLine
Else
If IsNumeric(txtECR.Value) = True Then
Range("C147").Value = txtECR.Value
End If
End If
....

Is there a way to have this work when its saved on the desktop or opened in
a web browser?
Thanks for any help
Jon
 
J

Joel

try this

Private Sub cmdCalc_Click()
Dim vEmpty As String
Dim vNumeric As String

with ActiveWorkbook.Sheets("Business Account Pricing")


' Check user input

If Me.txtECR.Value = "" Then
vEmpty = Chr(149) & " Earnings Credit Rate" & vbNewLine
Else
If IsNumeric(txtECR.Value) = True Then
.Range("C147").Value = txtECR.Value
End If
End If
end with
 
J

jeq214

Its still giving me the same error.

Joel said:
try this

Private Sub cmdCalc_Click()
Dim vEmpty As String
Dim vNumeric As String

with ActiveWorkbook.Sheets("Business Account Pricing")


' Check user input

If Me.txtECR.Value = "" Then
vEmpty = Chr(149) & " Earnings Credit Rate" & vbNewLine
Else
If IsNumeric(txtECR.Value) = True Then
.Range("C147").Value = txtECR.Value
End If
End If
end with
 
J

Joel

Does changing active to this make any differences

from
with ActiveWorkbook.Sheets("Business Account Pricing")

to
with ThisWorkbook.Sheets("Business Account Pricing")

This workbook is the workbook where the macro is located.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top