Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
double click excel file on the desktop excel opens but not file? | Excel Discussion (Misc queries) | |||
Connecting to a DB without using the local machines ODBC | Excel Programming | |||
Stoping users from saving tables to their local machines... | Excel Discussion (Misc queries) | |||
Local excel file to update website | Excel Programming | |||
Desktop shortcut to a named Excel file - every time I open it adds a "1" to the file name - how to disable? | Setting up and Configuration of Excel |