Hello,
I have adapted the map by Jordan Goldmeier to my own work, but I cannot figure out how to adapt and use the user-defined function to get shape's properties. I had to use a less convenient macro for this.
Could someone please explain in more detail how this user-defined function works and how to adapt it?
Specifically, I don't quite follow where the strState comes from. How does excel know where that comes from? I didn't see it defined elsewhere.
The VBA code is as follows:
Public Function GetTop(strState As String)
GetTop = Sheet2.Shapes("S_" & strState).Top
End Function
Public Function GetLeft(strState As String)
GetLeft = Sheet2.Shapes("S_" & strState).Left
End Function
Public Function GetHeight(strState As String)
GetHeight = Sheet2.Shapes("S_" & strState).Height
End Function
Public Function GetWidth(strState As String)
GetWidth = Sheet2.Shapes("S_" & strState).Width
End Function
The excel document can be downloaded from here:
http://optionexplicitvba.blogspot.ca/2012/08/interactive-map-in-excel-using-rollovers.html
Here is the file:
https://drive.google.com/file/d/0B1OBNnu3ZbL0VXFvZFFCa1J3UTA/view
Thank you for your help,
Emily
I have adapted the map by Jordan Goldmeier to my own work, but I cannot figure out how to adapt and use the user-defined function to get shape's properties. I had to use a less convenient macro for this.
Could someone please explain in more detail how this user-defined function works and how to adapt it?
Specifically, I don't quite follow where the strState comes from. How does excel know where that comes from? I didn't see it defined elsewhere.
The VBA code is as follows:
Public Function GetTop(strState As String)
GetTop = Sheet2.Shapes("S_" & strState).Top
End Function
Public Function GetLeft(strState As String)
GetLeft = Sheet2.Shapes("S_" & strState).Left
End Function
Public Function GetHeight(strState As String)
GetHeight = Sheet2.Shapes("S_" & strState).Height
End Function
Public Function GetWidth(strState As String)
GetWidth = Sheet2.Shapes("S_" & strState).Width
End Function
The excel document can be downloaded from here:
http://optionexplicitvba.blogspot.ca/2012/08/interactive-map-in-excel-using-rollovers.html
Here is the file:
https://drive.google.com/file/d/0B1OBNnu3ZbL0VXFvZFFCa1J3UTA/view
Thank you for your help,
Emily