English
Forum

Per ocx Blattschutz Remove with Excel-Tabellenblatt

 
- Page 1 -



Stephan
Sonneborn
Hello together,
in a Excel-Tabellenblatt (Stückliste) should item eigetragen go. the results to that one To foot, to that others through one Auswahlprogramm with provided Artikeln.
The Excel Presentation has a primitiven protection against unbeabsichtigtes Überschreiben falser boxes: Blattschutz without Password.

for the händische Edit the Stückliste have I one macro written, that whom Blattschutz aufhebt, a Leerzeile einfügt and then whom Blattschutz again setting.
In VBA is the then: ActiveSheet.Unprotect

at that Übertragen the Artikeldaten into Excelblatt by oxc must the Blattschutz too aufgehoben his. the wished I so manage:
'*-------------------------------------------------------------------------------------------------*
'* Exceldatei open                                                                               *
'*-------------------------------------------------------------------------------------------------*

PROC OpenExcelFile

    '*-------------------------------------------------------------------------------------------------*
    PARAMETERS File$
    '*-------------------------------------------------------------------------------------------------*
    DECLARE    UsedRange&, Rows&
    '*-------------------------------------------------------------------------------------------------*

    IF FILEEXISTS(File$)

        'Excel invisible started:
        Excel&      = ocxCREATE("Excel.Application")
        Workbooks&  = ocxGet(Excel&,"Workbooks")
        ExcelWnd&   = ocxGet(Excel&,"Hwnd")
        ocxPut(Excel&,"DisplayAlerts",1)
        ocxPut(Excel&,"Visible"      ,1)
        '*-------------------------------------------------------------------------------------------------*
        'Excel-Open File:
        ExcelBook&  = ocxMethod(Workbooks&,"Open"  , File$)
        ExcelSheet& = ocxGet(ExcelBook&,   "Sheets", ExcelSheet$)
        ocxPut(ExcelSheet&,  "Unprotect")
        Range&      = ocxGet(ExcelSheet&,  "Range", "A1")
        UsedRange&  = ocxGet(ExcelSheet&,  "UsedRange")
        Rows&       = ocxGet(UsedRange&,   "Rows")
        ExcelSheetLines& = ocxGet(Rows&,        "Count")
        LastBOMPos& = INT((ExcelSheetLines& - 19)/4)

    ELSE

        ExcelWnd& = 0

    ENDIF

    '*-------------------------------------------------------------------------------------------------*
    'Return Value:
    RETURN ExcelWnd&
    '*-------------------------------------------------------------------------------------------------*

ENDPROC

'*-------------------------------------------------------------------------------------------------*

unfortunately lead the to that Programmabsturz.
has someone a idea?
It's all right only around the entry ocxPUT(ExcelSheet&, "Unprotect"). without these row runs the code.
 
Schöne Grüße aus Wittgenstein
von Stephan

Programmierumgebung:| XProfan X4 | WIN10 | AMD FX6100 3,3 GHz
02/06/11  
 



« this Posting watts as Solution marked. »


Stephan
Sonneborn
has it!

simply instead of ocxPut ocxMethod take:
'*-------------------------------------------------------------------------------------------------*
'* Exceldatei open                                                                               *
'*-------------------------------------------------------------------------------------------------*

PROC OpenExcelFile

    '*-------------------------------------------------------------------------------------------------*
    PARAMETERS File$
    '*-------------------------------------------------------------------------------------------------*
    DECLARE    UsedRange&, Rows&
    '*-------------------------------------------------------------------------------------------------*

    IF FILEEXISTS(File$)

        'Excel invisible started:
        Excel&      = ocxCREATE("Excel.Application")
        Workbooks&  = ocxGet(Excel&,"Workbooks")
        ExcelWnd&   = ocxGet(Excel&,"Hwnd")
        ocxPut(Excel&,"DisplayAlerts",1)
        ocxPut(Excel&,"Visible"      ,1)
        '*-------------------------------------------------------------------------------------------------*
        'Excel-Open File:
        ExcelBook&  = ocxMethod(Workbooks&,"Open"  , File$)
        ExcelSheet& = ocxGet(ExcelBook&,   "Sheets", ExcelSheet$)
        ocxMethod(ExcelSheet&,  "Unprotect")
        Range&      = ocxGet(ExcelSheet&,  "Range", "A1")
        UsedRange&  = ocxGet(ExcelSheet&,  "UsedRange")
        Rows&       = ocxGet(UsedRange&,   "Rows")
        ExcelSheetLines& = ocxGet(Rows&,        "Count")
        LastBOMPos& = INT((ExcelSheetLines& - 19)/4)

    ELSE

        ExcelWnd& = 0

    ENDIF

    '*-------------------------------------------------------------------------------------------------*
    'Return Value:
    RETURN ExcelWnd&
    '*-------------------------------------------------------------------------------------------------*

ENDPROC

'*-------------------------------------------------------------------------------------------------*
 
Schöne Grüße aus Wittgenstein
von Stephan

Programmierumgebung:| XProfan X4 | WIN10 | AMD FX6100 3,3 GHz
02/06/11  
 



Very calm, have soeben a offshoots with Codesnippets prepares:  [...] 
 
02/07/11  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

5.592 Views

Themeninformationen

this Topic has 2 subscriber:

Stephan Sonneborn (2x)
iF (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie