Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Saving contents of a combobox

Status
Not open for further replies.

nochoice

Programmer
Jun 17, 2003
72
CA
Hello,

I have populated a combobox using:

ml.OLEFormat.Object.Column() = myarray

My problem is, once I have closed the document, after saving of course, I lose the contents of the combobox.

How do I save what has been inputted into the combobox?

Thanks in advance,
NoChoice
 
Hi nochoice,

If you are running your code from the document you have just closed you are going to have other problems when you close it. If you are not, then do you not still have the myarray variable from which you populated the combo?

Or are you asking for the selected item? If so, save it to another variable before closing the document.

Enjoy,
Tony

 
Ok let's see if I understand you here.

I do not run code once the document is closed so I won't have any problems with ending the script early or losing variables (I think those are the only problem I might have).

As far as I can tell, myarray is cleared once my document is closed, but not after I have populated the combobox, I think, in this case you suggest I save myarray to another variable before closing.

OK, now I'm a little confused. If I save myarray to another array, yourarray, for example, is this not going to be clearead once I close the doument as well? Should I save it to an object in the document such as a listbox?

Here is more code, maybe this will answer some questions:

myarray(0, Count) = sh.OLEFormat.Object.Name
myarray(1, Count) = sh.OLEFormat.Object.Caption

Note: This is how I fill myarray


Dim myarray(2, 500) As String

Note: this is how I declare my array


I hope this is making my problem more clear,
NoChoice

 
Hi nochoice,

Sorry, I misunderstood your question completely. You want to save the combo columns with the Document.

It's not my strongest area and I am prepared for someone else to correct me on this but I don't think you can do it. I think you will need to copy them somewhere else within the document which is horribly clumsy, to say the least.

Enjoy,
Tony
 
Thanks for your help,

What I'm working on now is transfering the array to excel and saving it there, which I'm hoping will keep things a little cleaner.

If anybody has any other suggestions.......

NoChoice
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top