MarkCBB
Active Member
- Joined
- Apr 12, 2010
- Messages
- 497
Hi there,
I think i am losing my mind a bit, I get the following error "Complie error: Method or data member not found"
I am using the following code:
But this line give me the above error:
and this one works fine:
Why would it not pick up the control if the Sheet is decleared?
I think i am losing my mind a bit, I get the following error "Complie error: Method or data member not found"
I am using the following code:
Code:
Sub AddPicture()
Dim MyPictureName1 As String
Dim MyPictureName2 As String
Dim MyPictureName3 As String
Dim SHT_LIST As Worksheet
Dim SHT_FilteredOutlet_DB As Worksheet
Dim SHT_Report5 As Worksheet
Dim i As Long
Set SHT_FilteredOutlet_DB = Sheet12
Set SHT_LIST = Sheet2
Set SHT_Report5 = Sheet7
i = SHT_LIST.Range("C11").Value
MyPictureName1 = SHT_FilteredOutlet_DB.Range("E4").Offset(i, 0).Value & " Front of store"
MyPictureName2 = SHT_FilteredOutlet_DB.Range("E4").Offset(i, 0).Value & " Inside of Store"
MyPictureName3 = SHT_FilteredOutlet_DB.Range("E4").Offset(i, 0).Value & " Nappies"
If Len(Dir("D:\testing\" & MyPictureName1 & ".png", vbDirectory)) < 0 Then MyPictureName1 = "HUGGIES"
If Len(Dir("D:\testing\" & MyPictureName1 & ".png", vbDirectory)) < 0 Then MyPictureName2 = "HUGGIES"
If Len(Dir("D:\testing\" & MyPictureName1 & ".png", vbDirectory)) < 0 Then MyPictureName3 = "HUGGIES"
SHT_Report5.Image1.Picture = LoadPicture("D:\testing\" & MyPictureName1 & ".png") ' DOES NOT WORK
Sheet7.Image1.Picture = LoadPicture("D:\testing\" & MyPictureName1 & ".png") ' WORKS FINE
End Sub
But this line give me the above error:
Code:
SHT_Report5.Image1.Picture = LoadPicture("D:\testing\" & MyPictureName1 & ".png") ' DOES NOT WORK
and this one works fine:
Code:
heet7.Image1.Picture = LoadPicture("D:\testing\" & MyPictureName1 & ".png") ' WORKS FINE
Why would it not pick up the control if the Sheet is decleared?