How to read settings in Word
How to read settings in Word
Hello,
How can I read a setting of Word in my FWH application?
I need to know the startup-folder of Word?
And if someone knows how, also the startup-folder of Excel or Outlook.
Thank you very much for any help.
How can I read a setting of Word in my FWH application?
I need to know the startup-folder of Word?
And if someone knows how, also the startup-folder of Excel or Outlook.
Thank you very much for any help.
Regards,
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
- Antonio Linares
- Site Admin
- Posts: 42270
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: How to read settings in Word
Dear Michel,
from chatGPT 4:
what specific setting are you looking for ?
from chatGPT 4:
Code: Select all | Expand
LOCAL oWord, cStartupPath
oWord = CREATEOBJECT("Word.Application")
cStartupPath = oWord.Options.DefaultFilePath(10) && 10 is wdStartupPath
? "Word Startup Folder:", cStartupPath
oWord.Quit
Re: How to read settings in Word
João Santos - São Paulo - Brasil - Phone: +55(11)95150-7341
Re: How to read settings in Word
hi,
as it is a Microsoft Product it will use Windows default Folder "Personal Files\Document"
... but File-Dialog Control "might" show you "last Folder"
---
under Xbase++ i have use a "Trick" to show "right" Folder
before call ActiveX i call File-Dialog Control "invisible" to set new Path and than close it
to use a "invisible" Control "just" set Position "outside" Screen e.g. {-1000, -1000}
do you mean which "Start" Folder when User want to "open" a Document or Sheet ?driessen wrote:I need to know the startup-folder of Word?
And if someone knows how, also the startup-folder of Excel or Outlook.
as it is a Microsoft Product it will use Windows default Folder "Personal Files\Document"
... but File-Dialog Control "might" show you "last Folder"
---
under Xbase++ i have use a "Trick" to show "right" Folder
before call ActiveX i call File-Dialog Control "invisible" to set new Path and than close it
to use a "invisible" Control "just" set Position "outside" Screen e.g. {-1000, -1000}
greeting,
Jimmy
Jimmy
Re: How to read settings in Word
Thanks a lot for any help.
I have the information I needed.
I have the information I needed.
Regards,
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
Re: How to read settings in Word
Hello,
I know now how to read settings in Word.
But can anyone help me in changing the settings in Word?
I also need to know how to put the startup setting in Word back to its default value?
Thank you.
I know now how to read settings in Word.
But can anyone help me in changing the settings in Word?
I also need to know how to put the startup setting in Word back to its default value?
Thank you.
Regards,
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
- Antonio Linares
- Site Admin
- Posts: 42270
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: How to read settings in Word
Dear Michel,
How are you finally reading the settings ?
Please post the code to see how to save them, thanks
How are you finally reading the settings ?
Please post the code to see how to save them, thanks
Re: How to read settings in Word
Antonio,
This is the code with the method how I read the startup folder of Word :I want to change the startup folder of Word from my FWH-application.
Thanks.
This is the code with the method how I read the startup folder of Word :
Code: Select all | Expand
******************************************************************************
LOCAL cStartupPath := ""
PRIVATE cWord
WordOle()
cStartupPath := cWord:Options:DefaultFilePath(8) // 8 is wdStartupPath
* CStartupPath contains the startup folder of Word.
* Standard it is : %USERPROFILE%\AppData\Roaming\Microsoft\Word\STARTUP
* but it might be changed for external reasons.
******************************************************************************
PROCEDURE WordOle
* This procedure builds the OLE-connection with Word
IF (cWord := WinWordObj()) = NIL
MsgAlert("Microsoft Word wasn't installed on this computer","Alert")
ENDIF
RETURN
******************************************************************************
Thanks.
Regards,
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
- Antonio Linares
- Site Admin
- Posts: 42270
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: How to read settings in Word
Dear Michel,
Please try this:
cWord:Options:DefaultFilePath(8) = cNewPath
MsgInfo( cWord:Options:DefaultFilePath(8) )
and check if it works and changes the path or generates an error
Please try this:
cWord:Options:DefaultFilePath(8) = cNewPath
MsgInfo( cWord:Options:DefaultFilePath(8) )
and check if it works and changes the path or generates an error
Re: How to read settings in Word
Antonio,
While compiling your example, I get the error : Error E0022 Invalid lvalue ':'
So the settings in Word can't be changed that way.
While compiling your example, I get the error : Error E0022 Invalid lvalue ':'
So the settings in Word can't be changed that way.
Regards,
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
- Antonio Linares
- Site Admin
- Posts: 42270
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: How to read settings in Word
Dear Michel,
Please try it this way:
cWord:Options:DefaultFilePath[8] = cNewPath
Please try it this way:
cWord:Options:DefaultFilePath[8] = cNewPath
- Antonio Linares
- Site Admin
- Posts: 42270
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: How to read settings in Word
Dear Michel,
Please review this:
https://learn.microsoft.com/en-us/offic ... ltfilepath
https://documentation.help/VBAWD10/wopr ... lePath.htm
It should work as the first try but Harbour syntax does not allows it
Please review this:
https://learn.microsoft.com/en-us/offic ... ltfilepath
https://documentation.help/VBAWD10/wopr ... lePath.htm
It should work as the first try but Harbour syntax does not allows it
Re: How to read settings in Word
Antonio,
I'm sorry, I wasn't able to solve my last problem yet, but I have a new question.
I need to read in my Fwh-application the exact position where my cursor is in a Word-document.
Later on I have to put the cursor back in its original position.
How can I do this?
Thx.
I'm sorry, I wasn't able to solve my last problem yet, but I have a new question.
I need to read in my Fwh-application the exact position where my cursor is in a Word-document.
Later on I have to put the cursor back in its original position.
How can I do this?
Thx.
Regards,
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
- Antonio Linares
- Site Admin
- Posts: 42270
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Re: How to read settings in Word
Dear Michel,
To save the current current position:
nStartPosition = oWordApp:Selection:Range:Start
nEndPosition = oWordApp:Selection:Range:End
To later restore the cursor position:
oWordApp:Selection:SetRange( nStartPosition, nEndPosition )
To save the current current position:
nStartPosition = oWordApp:Selection:Range:Start
nEndPosition = oWordApp:Selection:Range:End
To later restore the cursor position:
oWordApp:Selection:SetRange( nStartPosition, nEndPosition )
Re: How to read settings in Word
Antonio,
Once again, thank you very much.
It's working fine.
Once again, thank you very much.
It's working fine.
Regards,
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773
Michel D.
Genk (Belgium)
_____________________________________________________________________________________________
I use : FiveWin for (x)Harbour v. 24.07 - Harbour 3.2.0 (February 2024) - xHarbour Builder (January 2020) - Bcc773