Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default EXCEL 2010 VBA; trying to use INI File stored on local desktop machines

We are migrating from XCL 2003 to XCL 2010. The macro file resides on
a shared network drive. I am having difficulty getting the macro code
to "recognize" (extracting email parameters from the INI file; to be
used for the macro to send an email) the INI file. Each user has his
customized INI file stored on his H:\ drive.

These are my five unsuccessful attempts:

1) Public Const INI_PATH_TMPL = "H:\<USER_ID\My Documents\INI File\"

2) Public Const INI_PATH_TMPL = "\\ServerName\<USER_ID\My Documents
\INI File\"

whe
'sUserID = (Environ$("Username")) '<< THIS IS THE WIN 7 CODE FOR
ANY GIVEN USER

'GetUserID = Replace(sUserID, "corp\", "")

'GetINIFilename = Replace(APP_INI_PATH, "<USER_ID", GetUserID)

3) Public Const INI_PATH_TMPL = "H:\My Documents\INI File\"

4) Public Const INI_PATH_TMPL = "H:\loginID\My Documents\INI File\"

5) Public Const APP_INI_PATH = INI_PATH_TMPL & "Email.ini"

Please help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default EXCEL 2010 VBA; trying to use INI File stored on local desktop machines

On Aug 16, 2:58*pm, JingleRock wrote:
We are migrating from XCL 2003 to XCL 2010. The macro file resides on
a shared network drive. I am having difficulty getting the macro code
to "recognize" (extracting email parameters from the INI file; to be
used for the macro to send an email) the INI file. Each user has his
customized INI file stored on his H:\ drive.

These are my five unsuccessful attempts:

1) Public Const INI_PATH_TMPL = "H:\<USER_ID\My Documents\INI File\"

2) Public Const INI_PATH_TMPL = "\\ServerName\<USER_ID\My Documents
\INI File\"

whe
* * 'sUserID = (Environ$("Username")) '<< THIS IS THE WIN 7 CODE FOR
ANY GIVEN USER

* * 'GetUserID = Replace(sUserID, "corp\", "")

* * 'GetINIFilename = Replace(APP_INI_PATH, "<USER_ID", GetUserID)

3) Public Const INI_PATH_TMPL = "H:\My Documents\INI File\"

4) Public Const INI_PATH_TMPL = "H:\loginID\My Documents\INI File\"

5) Public Const APP_INI_PATH = INI_PATH_TMPL & "Email.ini"

Please help.


Actually, #5 is NOT an unsuccessful attempt; just indicates the INI
Filename string.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default EXCEL 2010 VBA; trying to use INI File stored on local desktop machines

INI files are usually managed using the PrivateProfileStrings APIs.
There's no reason I can see why code that worked in xl2003 shouldn't
work in xl2010 unless you were using some other dubious method.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default EXCEL 2010 VBA; trying to use INI File stored on local desktop machines

On Aug 16, 6:34*pm, GS wrote:
INI files are usually managed using the PrivateProfileStrings APIs.
There's no reason I can see why code that worked in xl2003 shouldn't
work in xl2010 unless you were using some other dubious method.

--
Garry

Free usenet access athttp://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


Thanks Garry.

A couple of things I failed to mention: at the same time we upgraded
OFFICE, we went to WIN 7; and, for each NW user, his/her 'My
Documents' folder is on the H:\ drive, instead of on the C:\drive.

Yes, you are correct; we are using 'GetPrivateProfileStringA' code and
'GetPrivateProfileIntA' code. Are there any References to Object
Libraries that we need? << as I key, there are five References -- they
are all pretty basic. I have not converted the .xls extension on the
macro file.

This code has been working fine for two years using xl2003 VBA. Also,
when I "hard-code" the email parameters (as opposed to extracting them
from the INI file) into the VBA code, the email is sent as directed.
Also, (Environ$("Username")) is working fine (no hard-coding).

Thanks for your help,
JingleRock
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default EXCEL 2010 VBA; trying to use INI File stored on local desktop machines

On Aug 16, 10:16*pm, JingleRock wrote:
On Aug 16, 6:34*pm, GS wrote:

INI files are usually managed using the PrivateProfileStrings APIs.
There's no reason I can see why code that worked in xl2003 shouldn't
work in xl2010 unless you were using some other dubious method.


--
Garry


Free usenet access athttp://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


Thanks Garry.

A couple of things I failed to mention: *at the same time we upgraded
OFFICE, we went to WIN 7; and, for each NW user, his/her 'My
Documents' folder is on the H:\ drive, instead of on the C:\drive.

Yes, you are correct; we are using 'GetPrivateProfileStringA' code and
'GetPrivateProfileIntA' code. Are there any References to Object
Libraries that we need? << as I key, there are five References -- they
are all pretty basic. I have not converted the .xls extension on the
macro file.

This code has been working fine for two years using xl2003 VBA.

Using xl2010 VBA,
when I "hard-code" the email parameters (as opposed to extracting them
from the INI file) into the VBA code, the email is sent as directed.
Also, *(Environ$("Username")) is working fine (no hard-coding).

Thanks for your help,
JingleRock


ADDITIONAL INPUT BY JingleRock:

Attempt #3 is most consistent w/ clicking on 'Start' and then
'searching programs and files'; also, it is most consistent w/ xl2003
coding ("C:\Documents and Settings\<USER_ID\My Documents\INI File\").
Attempt #2 makes the most sense, I guess, but it is not consistent w/
clicking on 'Start' and then 'searching programs and files'.

JingleRock


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,514
Default EXCEL 2010 VBA; trying to use INI File stored on local desktop machines

JingleRock wrote on 8/16/2011 :
On Aug 16, 10:16*pm, JingleRock wrote:
On Aug 16, 6:34*pm, GS wrote:

INI files are usually managed using the PrivateProfileStrings APIs.
There's no reason I can see why code that worked in xl2003 shouldn't
work in xl2010 unless you were using some other dubious method.
--
Garry


Free usenet access athttp://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


Thanks Garry.

A couple of things I failed to mention: *at the same time we upgraded
OFFICE, we went to WIN 7; and, for each NW user, his/her 'My
Documents' folder is on the H:\ drive, instead of on the C:\drive.

Yes, you are correct; we are using 'GetPrivateProfileStringA' code and
'GetPrivateProfileIntA' code. Are there any References to Object
Libraries that we need? << as I key, there are five References -- they
are all pretty basic. I have not converted the .xls extension on the
macro file.

This code has been working fine for two years using xl2003 VBA. Using
xl2010 VBA, when I "hard-code" the email parameters (as opposed to
extracting them from the INI file) into the VBA code, the email is sent as
directed. Also, *(Environ$("Username")) is working fine (no hard-coding).

Thanks for your help,
JingleRock


ADDITIONAL INPUT BY JingleRock:

Attempt #3 is most consistent w/ clicking on 'Start' and then
'searching programs and files'; also, it is most consistent w/ xl2003
coding ("C:\Documents and Settings\<USER_ID\My Documents\INI File\").
Attempt #2 makes the most sense, I guess, but it is not consistent w/
clicking on 'Start' and then 'searching programs and files'.

JingleRock


Sounds to me like Win7 access permissions may be at play here. The user
must have read/write permission to the location of the INI file.
Normally, this should work fine when files are stored under ~Documents
and Settings\<userid\My Documents\ or any of its subfolders.

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc


  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 45
Default EXCEL 2010 VBA; trying to use INI File stored on local desktop machines

Sounds to me like Win7 access permissions may be at play here. The user
must have read/write permission to the location of the INI file.
Normally, this should work fine when files are stored under ~Documents
and Settings\<userid\My Documents\ or any of its subfolders.

--
Garry


Since I created the 'INI File' folder and the INI file in it, I don't
think that is an issue.
And no 'Documents and Settings' folder, now.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
double click excel file on the desktop excel opens but not file? JPT4266 Excel Discussion (Misc queries) 3 May 7th 09 04:24 PM
Connecting to a DB without using the local machines ODBC David Wessell Excel Programming 0 May 3rd 07 04:01 PM
Stoping users from saving tables to their local machines... Philippe Roy Excel Discussion (Misc queries) 1 August 17th 05 06:47 PM
Local excel file to update website Anonymous Chief Excel Programming 0 August 17th 05 02:14 AM
Desktop shortcut to a named Excel file - every time I open it adds a "1" to the file name - how to disable? [email protected] Setting up and Configuration of Excel 2 November 27th 04 09:02 PM


All times are GMT +1. The time now is 03:55 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"