Ask the Expert

123 file shows blank in a frame

I've written the code below to open an existing 123 file from an action button atop a Notes form. It writes to the 123 file and saves/closes, but when you look at 123 you can't see the file (only see a blank 123 frame)! Who'd have thought? How do I get this 123 file to become visible?

thanks for taking a look.

 Sub Click(Source As Button) Dim w123 As Variant Dim r As Variant Set w123 = GetObject("c:bmcphee.123", "Lotus123.Workbook.98") Set r = w123.Ranges("A:A1..A:B10") r.Cell(0, 0, 0).Contents = "Hello 123, you infernal OLE Application." w123.Application.Visible = True Messagebox "Close 123" w123.Application.QUIT End Sub


Here's the code I've come up with that works. Functionally, it's identical to yours, except I was having some problems with the GetObject function - it would keep opening up 123 without a file (similar to your problem). So, I decided to open 123 through a CreateObject function call, then tell 123 to go open the file.

The next problem was the Ranges. I don't know why, but I couldn't get it to plop any text into the range specified, so I dug up some sample code from lotus and changed the property being changed (they were doing the background color) to Contents, then put in your comment. Now it works fine!

I added the code to save at the end just to prove a point to myself. No user interaction is required - if you keep the application object invisible, the user will never know it went to 123.

There is a downside here, it takes 123 a pretty good length of time to save the document (don't know why), so you might want to keep that in mind, if you DO want to do anything in the background with 123.

Here's the modified code - I ran it from a button in a mail document, but it should work from anywhere that it's called from the UI (action buttons, hotspot buttons, etc):

 Sub Click(Source As Button) Dim w123 As Variant Dim wb As Variant 'Dim r As Variant Set w123 = CreateObject("Lotus123.Workbook") w123.Application.Visible = True Set wb = w123.Application.OpenDocument("c:tempbmcphee.123") wb.Ranges("A:A1..A:B10").Contents = "Hello, 123 you infernal OLE Application." wb.Save w123.Application.Quit 'Set r = w123.Ranges("A:A1..A:B10") 'r.Cell(0, 0, 0).Contents = "Hello 123, you infernal OLE Application." 'Messagebox "Close 123" 'w123.Application.QUIT End Sub


This was first published in April 2002

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: