Here's what I have so far. I make a template form with an ole object on it. I then start a loop for all the files in a directory. I copy the master form under a different name. I open that new form with open args (path of the file to load)... and then this code runs. That works fine, but after I save it and reopen the form, the doc is gone. I need it to stay there forever without having to reload! Private Sub Form_Load() On Error GoTo Gestion Dim spath As String Dim sVars() As String If Me.OpenArgs > "" Then 'time to set all the details sVars = Split(Me.OpenArgs, ";") spath = Right(sVars(0), Len(sVars(0)) - 2) With Me.OLEWordDoc .Enabled = True .Locked = False ' Specify what kind of object can appear in the field. .OLETypeAllowed = acOLEEmbedded ' Class statement for Word document. .Class = "Word.Document" ' Specify the file to be embedded. ' Type the correct path name. .SourceDoc = spath ' Create the embedded object. 'this is where it takes 3-5 seconds .Action = acOLECreateEmbed ' Optional size adjustment. .SizeMode = acOLESizeZoom End With End If Exit Sub Gestion: MsgBox Err.Description & " : " & Err.Number End Sub
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE