+ Reply to Thread
Results 1 to 11 of 11

Unable to Dim shp As Shape

  1. #1
    Registered User
    Join Date
    06-08-2017
    Location
    USA
    MS-Off Ver
    365
    Posts
    4

    Unhappy Unable to Dim shp As Shape

    Hi All,
    I'm not sure what I did here..

    When I try to "Dim shp As Shape" vba is changing this to "Dim shp As sHape". This is causing my script to fail.

    I have tried doing a replace all in project, but no matter what, I can't get the word sHape back to Shape.

    Any ideas?

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Unable to Dim shp As Shape

    It's not causing your code to fail - the most likely cause is because you have named something as 'sHape' elsewhere or declared a variable named 'sHape'...

  3. #3
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Unable to Dim shp As Shape

    do you have a variable called sHape being assigned a value in your code already? sounds like a conflict of some kind... can you provide the workbook?
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  4. #4
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: Unable to Dim shp As Shape

    Is there class module or some add-in that's using "sHape"?

    That can cause conflict. But I've never seen it. If there are no other module in your workbook...
    Try cleaning up Personal.xlsb file. EDIT: (I've pranked someone by modifying Personal.xlsb. Application.Speach.Speak )
    ?Progress isn't made by early risers. It's made by lazy men trying to find easier ways to do something.?
    ― Robert A. Heinlein

  5. #5
    Registered User
    Join Date
    06-08-2017
    Location
    USA
    MS-Off Ver
    365
    Posts
    4

    Re: Unable to Dim shp As Shape

    Thanks guys...
    I did try a 'replace all' on the entire project, even a replace all to "hhhhuuu" then from hhhhuuu to Shape, but it still ends up as sHape. I don't have any addins loaded.

    Where do i find this Personal.xlsb file?

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Unable to Dim shp As Shape

    Do you have, or have you ever had anything, and I mean anything, named 'sHape'?
    If posting code please use code tags, see here.

  7. #7
    Forum Expert CK76's Avatar
    Join Date
    06-16-2015
    Location
    ONT, Canada
    MS-Off Ver
    Office 365 ProPlus
    Posts
    5,883

    Re: Unable to Dim shp As Shape

    Please Login or Register  to view this content.
    Exact location will depend on your OS/Excel version.
    https://support.office.com/en-us/art...5-cf5f1d292c19

    Personal.xlsb is found in "...\Microsoft\Excel\XLStart" folder, but it may be hidden. You will need to show hidden files using folder option in the explorer.

  8. #8
    Registered User
    Join Date
    06-08-2017
    Location
    USA
    MS-Off Ver
    365
    Posts
    4

    Re: Unable to Dim shp As Shape

    Okay, so I can't find a personal.xlsb file anywhere, i'm guessing I don't have one..

    Earlier I pasted the following into my code during testing, but have since deleted it.

    Please Login or Register  to view this content.

  9. #9
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Unable to Dim shp As Shape

    never use those reserved words for your variable names... it can only cause grief... changing caps on a different letter will not really help.
    Are you able to attach the workbook (remove sensitive data).
    Have you done a search through all the code (project), and made sure there is no sHape left? then closed and re-opened Excel (not just workbook)

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Unable to Dim shp As Shape

    Try adding this, compile and then delete.
    Please Login or Register  to view this content.
    PS I had a similar problem and used something like this to sort things.

  11. #11
    Registered User
    Join Date
    06-08-2017
    Location
    USA
    MS-Off Ver
    365
    Posts
    4

    Re: Unable to Dim shp As Shape

    Norie,
    Thanks for your help. That seems to have fixed it!

    Thanks all!!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Shape buttons - Switch background image of shape on click and exit - referenced jpg
    By ApatheticAndrew in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-14-2015, 08:06 AM
  2. Assign macro with parameter to shape based on shape location
    By bobo3127 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-23-2014, 11:18 AM
  3. Replies: 13
    Last Post: 12-10-2013, 12:51 PM
  4. [SOLVED] Use a button to control a macro that inserts an image into a shape or resets the shape
    By nwb in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-13-2013, 04:41 PM
  5. Add command button to shape and change shape color on mouseover
    By maacmaac in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-26-2012, 05:12 PM
  6. Replies: 0
    Last Post: 11-30-2012, 01:29 PM
  7. Replies: 3
    Last Post: 11-08-2012, 07:25 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1