× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



maybe qualifiy with application.GetOpenFileName

there is also a direct call to the GetOpenFileName api:
http://msdn.microsoft.com/en-us/library/aa155724(v=office.10).aspx

Private Declare Function GetOpenFileName _
Lib "COMDLG32.DLL" Alias "GetOpenFileNameA" _
(pOpenfilename As OPENFILENAME) As Long
Private Declare Function GetSaveFileName _
Lib "COMDLG32.DLL" Alias "GetSaveFileNameA" _
(pOpenfilename As OPENFILENAME) As Long
Private Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
Flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type

Sub GetFileFromAPI ()
Dim OFN As OPENFILENAME
With OFN
.lStructSize = Len(OFN) ' Size of structure.
.nMaxFile = 260 ' Size of buffer.
' Create buffer.
.lpstrFile = String(.nMaxFile - 1, 0)
Ret = GetOpenFileName(OFN) ' Call function.
If Ret <> 0 Then ' Non-zero is success.
' Find first null char.
n = InStr(.lpstrFile, VbNullChar)
' Return what's before it.
MsgBox Left(.lpstrFile, n - 1)
End If
End With
End Sub



On Fri, Jul 15, 2011 at 4:44 PM, Mira, Antonio <antonio.mira@xxxxxxxxxxx>wrote:

Just tried it but get the same error...

Thank you,

Antonio Mira
Application Developer - Mid-West Region
Time Warner Cable
1015 Olentangy River Road - 2nd Floor
Columbus, OH 43212
http://www.timewarnercable.com
phone: 614 827 7949
cell: 614 365 0489





-----Original Message-----
From: systemidotnet-bounces@xxxxxxxxxxxx [mailto:
systemidotnet-bounces@xxxxxxxxxxxx] On Behalf Of Steve Richter
Sent: Friday, July 15, 2011 4:16 PM
To: .net use with the System i
Subject: Re: [SystemiDotNet] Question about running macros...

try to replace
Set ObjFSO1 = CreateObject("UserAccounts.CommonDialog")
with
Set ObjFSO1 = CreateObject("GetOpenFileName")
here is another article:
http://msdn.microsoft.com/en-us/library/aa155724(v=office.10).aspx

and some code:
http://pastebin.com/6qwdgzaB

Set ObjFSO = CreateObject("GetOpenFileName")
ObjFSO.Filter = "All Files|*.*"
ObjFSO.FilterIndex = 3
ObjFSO.InitialDir = "C:\"
InitFSO = ObjFSO.ShowOpen
If InitFSO = False Then
Wscript.Quit
Else
ObjFSO.delete
End If


On Fri, Jul 15, 2011 at 4:06 PM, Mira, Antonio <antonio.mira@xxxxxxxxxxx
wrote:

I did find a work around, though not pretty but it works. I commented
out
the code that attempts to open the Dialog Box and hard coded the file
name
that I needed to open and now the macro runs as intended. The issue
seems
to be something in Win 7 and UserDialog boxes.

Thank you,

Antonio Mira
Application Developer - Mid-West Region
Time Warner Cable
1015 Olentangy River Road - 2nd Floor
Columbus, OH 43212
http://www.timewarnercable.com
phone: 614 827 7949
cell: 614 365 0489





-----Original Message-----
From: systemidotnet-bounces@xxxxxxxxxxxx [mailto:
systemidotnet-bounces@xxxxxxxxxxxx] On Behalf Of Richard Schoen
Sent: Friday, July 15, 2011 1:21 PM
To: systemidotnet@xxxxxxxxxxxx
Subject: Re: [SystemiDotNet] Question about running macros...

Google is your friend:

useraccounts.commondialog activex not found

Regards,
Richard Schoen
RJS Software Systems Inc.
Where Information Meets Innovation
Document Management, Workflow, Report Delivery, Forms and Business
Intelligence
Email: richard@xxxxxxxxxxxxxxx
Web Site: http://www.rjssoftware.com
Tel: (952) 736-5800
Fax: (952) 736-5801
Toll Free: (888) RJSSOFT

----------------------------------------------------------------------

message: 1
date: Fri, 15 Jul 2011 11:52:20 -0400
from: "Mira, Antonio" <antonio.mira@xxxxxxxxxxx>
subject: [SystemiDotNet] Question about running macros...

Hello,

I have a macro that I created for an end user to do some repetitive tasks
on a green-screen iSeries session. The macro is written in VB script and
it
runs fine under Windows XP. Recently, the user upgraded to Win 7 and
when
she tries to run the macro, she gets the following error:

Error in the script on line 190: AcitveX component can't create object:
'UserAccounts.CommonDialog'.

What the macro is attempting to do at that point is this command:

Set ObjFSO1 = CreateObject("UserAccounts.CommonDialog")

Which is needed to open an "Open File" dialog so the user can open a csv
file for the macro to process it.

Has anybody run into this situation? And if so, what did you do resolve
it?
As always, thanks for the help. I have researched on the internet for
this
type of error and tried the solutions offered but had not had any luck.



Thank you,

Antonio Mira
Application Developer

--
This is the .net use with the System i (SystemiDotNet) mailing list
To post a message email: SystemiDotNet@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/systemidotnet
or email: SystemiDotNet-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/systemidotnet.

This E-mail and any of its attachments may contain Time Warner Cable
proprietary information, which is privileged, confidential, or subject to
copyright belonging to Time Warner Cable. This E-mail is intended solely
for
the use of the individual or entity to which it is addressed. If you are
not
the intended recipient of this E-mail, you are hereby notified that any
dissemination, distribution, copying, or action taken in relation to the
contents of and attachments to this E-mail is strictly prohibited and may
be
unlawful. If you have received this E-mail in error, please notify the
sender immediately and permanently delete the original and any copy of
this
E-mail and any printout.
--
This is the .net use with the System i (SystemiDotNet) mailing list
To post a message email: SystemiDotNet@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/systemidotnet
or email: SystemiDotNet-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/systemidotnet.

--
This is the .net use with the System i (SystemiDotNet) mailing list
To post a message email: SystemiDotNet@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/systemidotnet
or email: SystemiDotNet-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/systemidotnet.

This E-mail and any of its attachments may contain Time Warner Cable
proprietary information, which is privileged, confidential, or subject to
copyright belonging to Time Warner Cable. This E-mail is intended solely for
the use of the individual or entity to which it is addressed. If you are not
the intended recipient of this E-mail, you are hereby notified that any
dissemination, distribution, copying, or action taken in relation to the
contents of and attachments to this E-mail is strictly prohibited and may be
unlawful. If you have received this E-mail in error, please notify the
sender immediately and permanently delete the original and any copy of this
E-mail and any printout.
--
This is the .net use with the System i (SystemiDotNet) mailing list
To post a message email: SystemiDotNet@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/systemidotnet
or email: SystemiDotNet-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/systemidotnet.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.