Prev: Insert a blank paragraph and page number in footer
Next: Searching for Frame in current header and delete it
From: Ed on 22 Nov 2009 05:53 I want to save an INI file to a user selected location. I need to automate the process with VBA. I have read the data I want from the registry and placed it onto my editing screen. I want the user to navigate to the folder to store the file and save it as 'MyINIFile.ini'. With Dialogs(wdDialogFileSaveAs) .name = "MyINIFile.ini" CloseNum = .Display End With When the above runs, Word forces me into a doc file. When I change to this: With Dialogs(wdDialogFileSaveAs) .name = "XXXXX.ini" .Format = wdFormatDOSTextLineBreaks CloseNum = .Display End With Word forces me into a .txt file. No option exists for INI. Any way to allow an INI file extension (and not confuse the user)? (Note that I use '.Display' not show. That way I can at least get a user to navigate to the proper folder, capture the path and behind the scenes save the proper file, but that is really confusing to the user who will think he has saved a txt file.) Ed (in Virginia)
From: Doug Robbins - Word MVP on 22 Nov 2009 06:14 An .ini file is just a text file with a particular structure. However, perhaps you should use System.PrivateProfileString -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "Ed" <nospam(a)nospam.com> wrote in message news:xK8Om.27288$cd7.3252(a)newsfe04.iad... > I want to save an INI file to a user selected location. I need to automate > the process with VBA. > > I have read the data I want from the registry and placed it onto my > editing screen. I want the user to navigate to the folder to store the > file and save it as 'MyINIFile.ini'. > > With Dialogs(wdDialogFileSaveAs) > .name = "MyINIFile.ini" > CloseNum = .Display > End With > > When the above runs, Word forces me into a doc file. > > When I change to this: > > With Dialogs(wdDialogFileSaveAs) > .name = "XXXXX.ini" > .Format = wdFormatDOSTextLineBreaks > CloseNum = .Display > End With > > Word forces me into a .txt file. No option exists for INI. > > Any way to allow an INI file extension (and not confuse the user)? (Note > that I use '.Display' not show. That way I can at least get a user to > navigate to the proper folder, capture the path and behind the scenes save > the proper file, but that is really confusing to the user who will think > he has saved a txt file.) > > Ed (in Virginia) >
From: Jonathan West on 22 Nov 2009 16:58
"Ed" <nospam(a)nospam.com> wrote in message news:xK8Om.27288$cd7.3252(a)newsfe04.iad... >I want to save an INI file to a user selected location. I need to automate >the process with VBA. > Use Karl Peterson's kpini class module http://vb.mvps.org/samples/kpIni/ -- Regards Jonathan West |