Jump to content
Do Not Sell My Personal Information


  • Join Toyota Owners Club

    Join Europe's Largest Toyota Community! It's FREE!

     

     

Visual Basic


bigshark
 Share

Recommended Posts

anyone here knows their stuff about macros/VB using excel??

what i am trying to do is to transfer all jpg pics from a specific folder to a word/excel document. the key bit is that it searches for a particular word, i.e. picture001, then replacing that word with a picture... next word, next pic etc etc

a bit like facebook when adding pictures, it automaticly selects the photos from the folder and upload with a touch of a button!

any ideas?? :unsure:

Link to comment
Share on other sites


anyone here knows their stuff about macros/VB using excel??

what i am trying to do is to transfer all jpg pics from a specific folder to a word/excel document. the key bit is that it searches for a particular word, i.e. picture001, then replacing that word with a picture... next word, next pic etc etc

a bit like facebook when adding pictures, it automaticly selects the photos from the folder and upload with a touch of a button!

any ideas?? :unsure:

I learn't some VB programming at Uni & seem to remember that the Word/Excel VB scripts utility didn't quite work the same.. however It may be possible to use word the way you wish. I have had to do basic conversions on paragraphs that I scanned from manuscripts, etc. This was a few years ago when I used word processing a lot in my job, and Word2000 was capable of more than I used it for! I know a man to ask who should know, but probably won't reply until next working week (April) so I suppose it may depend on what version of Word/excel you have.

You could also try one of the VB sites that offer up free downloads of scripts and programs that programmers allow others to have. Avoid some ready-to-run programs or at least check reviews of such a program and virus-check the program - I had a virus several years ago from a free VB program I wanted to try.

You should be able to get scripts, and quite possibly to do almost all or exactly what you want (sods law- others will have thought of same as you, question is has anybody written a solution!) ..with a little cut and pasting you might get lucky. Probably find some tutorials on using scripts somewhere on the web if you Google for it.

Mat - Raver-too

Link to comment
Share on other sites

this should give you a start

Private Sub CommandButton1_Click()
Dim fd As FileDialog
Dim counter As Long
Set fd = Application.FileDialog(msoFileDialogFilePicker)
Dim PictObj
Dim vrtSelectedItem As Variant
With fd
.Filters.Add "Images", "*.gif; *.jpg; *.jpeg", 1
If .Show = -1 Then
For Each vrtSelectedItem In .SelectedItems
Set PictObj = ActiveSheet.Pictures.Insert(vrtSelectedItem)
With PictObj
.ShapeRange.Top = 57 * counter
.ShapeRange.LockAspectRatio = msoTrue
.ShapeRange.Height = 57#
.ShapeRange.Width = 57#
counter = counter + 1
End With
Next vrtSelectedItem
End If
End With
Set fd = Nothing
Set PictObj = Nothing
End Sub

it opens a dialog windows which allows you to select multiple images and then it displays them in the woksheet

Link to comment
Share on other sites

cheers guys!! think i've almost cracked it!! just needs a few tweeks and it should be there!!

Link to comment
Share on other sites

Latest Deals

Toyota Official Store for genuine Toyota parts & accessories

Disclaimer: As the club is an eBay Partner, The club may be compensated if you make a purchase via eBay links

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share







×
×
  • Create New...




Forums


News


Membership