Posts by itsallgood

    Re: Word cannot have TextBox1.visible = false???


    Thanks for all your help everyone!


    What i was basicly trying to do was have a textbox visible, then hide it soon as the document loaded.


    That way, if macros were disabled, the user would see the textbox with instructions on how to turn macros on. Once this was done, the code to hide the textbox would be able to run, and it wouldnt be seen.


    Cheers all. :thanx:

    Re: Image box containing an "image list" such that the image can be easily changed


    I've added a 2nd image, and the size has shot stright up!?


    I think it could be my version of word. The one you sent me was great, 63kb.


    But even in yours, if i save the doc after i've clicked the image in the userform (got it now thanks ;) ), the file size goes upto 256kb


    Cheers again andy, it looks like somthing wrong with my word.


    Regards

    Re: Image box containing an "image list" such that the image can be easily changed


    If you click on one of the smaller images, and scroll down the page and back up, the larger image will have changed.


    I dont know about "imageboxes on a userform" ( i dont know what a userform is :roll: )


    Is my way the reason its so big then? if i could have some way of clicking smaller images on a "userform" and it makes one bigger, would it be possible to give me the code on how to do it?


    Regards.

    Re: Image box containing an "image list" such that the image can be easily changed


    yes, thanks,


    Heres a cut down version (as the full one is 8mb)


    there are 2 jpgs, with a total of 49kbs


    and the doc is already up to 1.27mbs.


    http://premium1.uploadit.org/itsall3//New-Folder.zip



    Im trying to do the same as i said in the last post, clicking the smaller one changes the large empty one. -- It works great, but the doc size is crazy :yikes:



    Thanks.

    Re: Image box containing an "image list" such that the image can be easily changed


    It wont work for me :(


    I have 5 jpegs, with a total size of 212kbs. -- so i would have throught that the file size would be less then a meg.


    This is the only code in the doc:



    Its basicly 5 small images, and clicking on them, loads that image into the larger one.


    I'm using word 2002.


    Any ideas why the doc is so big. I've tried the "fast saves" idea, but that doesnt work.


    Many thanks.

    Re: Image box containing an "image list" such that the image can be easily changed


    Quote from Andy Pope

    You would need to use multiple image controls to hold the pictures.
    With code you can then either make the appropriate image visible or load the picture into 1 image control used for display[vba] imgHolder.Picture = Image1.Picture[/vba]



    This methord works great, but the for some reason, a vba image, only holds bitmaps. You can add a jpg/gif - but the file size will be bitmap size. - Making the doc massive.


    Is there anway to import standard images, then do what you have put andy?


    Like imgholder.picture = embeddedpicture1


    Regards.

    Re: Dynamic Chart in Word using VBA???


    haha, you are a legend man, thanks so much.


    I wish i could paypal you a pint, i've been trying to do this for 2 days before i found this forum.


    :thanx: :thanx: :thanx:


    All the best matey.


    Cheers.

    Re: Dynamic Chart in Word using VBA???


    arrr, i spent ages trying that and it didnt work, then when you showed me it, i realised what i was doing, i was putting the line above " lngRow = 2" - d'oh


    Wow, you've been great mate, never had show much help on the net before.


    I tried your advice about using excel to record macros and see how they work, they work great in excel, but moving them over to word, aint to great.


    Like this:


    Code
    ActiveSheet.ChartObjects("Chart 1").Activate
        ActiveChart.ChartArea.Select
        ActiveChart.ChartType = xlPie


    A nice easy way to change the chart from line graph into a piechart.


    Does it work in word? nope. :roll:


    You'd think it would be the same all the way through the office suite.


    Cheers for your help. :thanx:

    Re: Dynamic Chart in Word using VBA???


    Is there anyway to do somthing like this?


    Var1 = objMSGraph.Object.Application.DataSheet.Cells(lngRow, 2).text


    Just to get the value in the cell,


    Or is that hoping too much? :roll:



    Cheers.

    Re: Dynamic Chart in Word using VBA???


    Ok, i kind of get how it works now, but i've got 2 problems really. :?



    I cannot update a chart while the doc. is protected. -- this is somthing i would really need to do. I'm guessing theres a way round this, maybe unprotect the doc with a macro, then protect it again after update.



    And another problem is that i need to update rows without knowing the previous value.


    Right now its:


    Code
    = Replace(objMSGraph.Object.Application.DataSheet.Cells(lngRow, 2), "value1", "value2")


    where "value1" is where what it looks for to replace (if im wrong about this let me know, its your code matey, im just saying what i think i've worked out :thanx: )


    I need a way to change the value of "value1" without knowing it. like "row1 = 10"


    Cheers for your help again andy, you've saved me today :thanx:

    Re: Dynamic Chart in Word using VBA???


    yay! Thanks andy, that works great.


    Now i just have to work it out. :)



    ----
    edit:


    Got it matey, thanks so much, I can now change the differnt lines.


    Just need to work out how to change the graph view from within VBA.




    Anyway, thanks again andy, you've been really helpful.


    Cheers

    Re: Dynamic Chart in Word using VBA???


    Thanks for your reply,


    But the example in the search doesnt work for me.


    I used your example macro on this thread: http://www.ozgrid.com/forum/showthread.php?t=32873


    But when i run it, i get an error from this line:


    Code
    Set objMSGraph = ActivePresentation.Slides(1).Shapes(3).OLEFormat.Object.Application

    -- Runtime error '424' Object Required.


    Heres what i did:


    Added the graph object lib to the references in VBA.
    Then made a graph by "insert -> Object -> Microsoft Graph Chart"
    Pasted your example code.
    Ran it. Got the above error.


    I think the problem could be as simple as i dont know how to give the graph a "Name" -- like from "DEFAULT TEXBOX1" to "inputName" type thing.


    Any more help would be great thanks.

    Hi guys,


    Great looking forum, just found it today when trying to get an answer to this question...


    How do you make a graph/chart in word that can be edited using VBA.


    I would like a graph that a user can make changes to the data using vba textboxes, and maybe change the graph type using tickboxes (pie/line/etc)



    -- One step at a time though ;) if somone could just tell me how to actually just change the value of a "microsoft graph chart" datasheet, i will prob be able to work the rest out myself.


    Thanks for any help.


    Regards. :thanx: