0

When i try to insert picture manually it gets inserted. When i try to insert it with the recorded macro it shows error cannot insert picture. i think it is due to picture name. image name

HCLL20220419 色块 50x65cm-效果图.jpg\

Recorded Macro

 ActiveSheet.Pictures.Insert( "C:\Users\ABDULLAH\Pictures\HCLL20220419 ?? 50x65cm-???.jpg").Select

Any help will be appreciated

braX
  • 11,506
  • 5
  • 20
  • 33
abdullah
  • 86
  • 1
  • 7
  • 2
    The VBA editor is not unicode but you could create a sheet called images and put the filename HCLL20220419 色块 50x65cm-效果图.jpg into a cell, then use `ActiveSheet.Pictures.Insert( Sheets("images").Cells(1,1).Value).Select` – CDP1802 Mar 04 '23 at 10:39
  • But i need to loop through directory's and get image name from there and that also have same issue. Is there any way to get the name in vba – abdullah Mar 04 '23 at 13:55
  • Post the code you are using to loop through directory. – CDP1802 Mar 04 '23 at 14:01
  • You [already posted](https://stackoverflow.com/q/75632175/11683) that question and deleted it when it was closed as duplicate. – GSerg Mar 04 '23 at 15:59
  • Becasuse i couldn't find answers in those questions they are either about declaring constant or about using file system library both of which aren't feasible in my case because have to use this on mac and these are dynamic names inside folders. – abdullah Mar 04 '23 at 18:56
  • @abdullah One would think you would mention such important fact that you are on mac. There is indeed no FSO on mac. But VBA's `Dir` cannot give you the Unicode file names. And you cannot have Unicode characters in your VBA editor, which is the two mistakes that you are making. In the current form, however, your question is closed appropriately, as you don't mention enumerating files here, only that you have pasted a Unicode file name into the editor. – GSerg Mar 04 '23 at 21:57

0 Answers0