Notices
Results 1 to 4 of 4

Thread: Macro question

  1. #1 Macro question 
    Forum Bachelors Degree Shaderwolf's Avatar
    Join Date
    Dec 2005
    Location
    OPSEC, baby. Sorry.
    Posts
    425
    Hey, I dont know much about macros or about scripting, but I've got a project to do for work and I looked up some codes and spliced them togeather to fit my specific purpose.
    I'm pulling pictures out of folders and sticking them in an excel file. You'll understand what I mean when you read the script (if you know what you're talking about at least lol)

    here's what I have so far:

    Private Sub CommandButton17_Click()
    Range("A35:K69").Select
    Dim subfolder As String
    subfolder = Range("A7")
    Dim picname As String
    picname = Range("B9")
    ActiveSheet.Pictures.Insert(ThisWorkbook.Path & ("\" & subfolder & "\" & picname & ".jpg")).Select
    Selection.ShapeRange.ScaleWidth 0.93, msoFalse, msoScaleFromTopLeft
    Selection.ShapeRange.ScaleHeight 0.88, msoFalse, msoScaleFromTopLeft
    ActiveWindow.SmallScroll Down:=8
    End Sub

    Pretty simple. "ThisWorkbook.Path gives me the path to the folder I want (the folder my excel file is in), and ("\" & subfolder & "\" & picname & ".jpg") give me the extentions to look into the folder and insert the pick I want. The latter should fit onto the former and make one address, but I'm having trouble with the connection point where the & is located. Any help would be much appreciated.

    Also, I would like to create another button to open "subfolder" (whichever is named in the cell) in the browser in a new window, but have no idea how to tackle that task...

    One more thing, there is no reason to tell me to just begin with the actual source address instead of "ThisWorkbook.Path... that's how it was before. I'm trying to create a floating file referance so I can use the file on multiple computers.


    Here's the problem with questions like "what would we see if we traveled faster than the speed of light". Since the rules that govern the universe as we understand them do not allow for such a possibility, to imagine such an event forces us to abandon those rules. But that leaves us no guide by which to answer the question. We have no idea as to what rules to replace them with, and we can't give an answer. - Janus
    Reply With Quote  
     

  2.  
     

  3. #2  
    Forum Bachelors Degree Shaderwolf's Avatar
    Join Date
    Dec 2005
    Location
    OPSEC, baby. Sorry.
    Posts
    425
    no one has any idea?


    Reply With Quote  
     

  4. #3  
    WYSIWYG Moderator marnixR's Avatar
    Join Date
    Apr 2007
    Location
    Cardiff, Wales
    Posts
    5,760
    sorry, macros aren't my forte
    "Reality is that which, when you stop believing in it, doesn't go away." (Philip K. Dick)
    Reply With Quote  
     

  5. #4  
    Forum Bachelors Degree Shaderwolf's Avatar
    Join Date
    Dec 2005
    Location
    OPSEC, baby. Sorry.
    Posts
    425
    Thanks at least for letting me know I'm not getting ignored MarnixR I found out what was wrong, so it's all good! (there was a folder that I skipped over, inbetween the workbook location and the refrenced subfolder) There was nothing wrong with the actual scriptig in the first place.
    Here's the problem with questions like "what would we see if we traveled faster than the speed of light". Since the rules that govern the universe as we understand them do not allow for such a possibility, to imagine such an event forces us to abandon those rules. But that leaves us no guide by which to answer the question. We have no idea as to what rules to replace them with, and we can't give an answer. - Janus
    Reply With Quote  
     

Similar Threads

  1. Using Solver in an Excel macro
    By Bunbury in forum Computer Science
    Replies: 1
    Last Post: April 29th, 2011, 09:34 AM
  2. RELATED QUESTION TO MY LIGHT QUESTION BELOW
    By BARCUD in forum Physics
    Replies: 9
    Last Post: January 30th, 2009, 06:58 AM
  3. Evidence of macro-evolution
    By BumFluff in forum Behavior and Psychology
    Replies: 11
    Last Post: June 25th, 2008, 05:07 AM
  4. help with macro economics
    By vj_su in forum Business & Economics
    Replies: 2
    Last Post: March 5th, 2006, 03:04 PM
Bookmarks
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
  •