Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB code 'range' error when opening XL sheet from hyperlink

Status
Not open for further replies.

baronvont

Technical User
May 15, 2001
77
AU
Hi all.

Can anyong shed light on this problem. I have an XL sheet with the following code on a command button in the sheet:

Range("a1").Value = "hahahaha"

The same code is placed in a command buttton, but on a userform. Both work as expected.

However, I now hyperlink to the sheet from a web page, opening the sheet in an IE shell and the sheet command works but the form one throws up

Run-time error '1004'
Method 'Range' of object '_Global' failed

I'd be most greatful for any suggestions

Thanks
Georg
 


Hi,

Specify the sheet object explicitly...
Code:
 MySheet.Range("A1").Value = ....


Skip,
[sub]
[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue][/sub]
 
as in worksheets(1).Range("a1").Value = "hahahaha" ??

Tried it already...that throws up

"Application-defined or object-defined error"

Georg
 


You may need to FULLY qualify...
Code:
application.workbook.worksheet.range....
"Application-defined or object-defined error" indicates the object is not properly quallified.


Skip,
[sub]
[glasses] [red]A palindrome gone wrong?[/red]
A man, a plan, a ROOT canal...
PULLEMALL![tongue][/sub]
 
OK got it...

Workbooks(1).Worksheets(1).Range("a1") = "hahaha"

This stuff will be the death of me one day

Thanks
for the help
Georg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top