Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Public declare for Set....


Hi, I have to use many workbooks in my program and I want to set th
name of my workbook once. How can I do that ?

At this moment, I copy SetRefs in all modules and I run it at first
but is it possible to do that once.

thanks,

Public wbBook1 As Workbook
Public wbBook2 As Workbook
Public wbBook4 As Workbook
Public wbBook5 As Workbook

Public Sub SetRefs()
Dim ProjetActif As Variant, Projet As String
Set wbBook1 = Workbooks("Repair_follow_up.xls")
Set wbBook2 = Workbooks("Repairs.xls")
Set wbBook4 = Workbooks("Clients.xls")
wbBook1.Activate
Sheets("Feuille Calcul").Select
ProjetActif = Cells(3, 5)
Projet = ProjetActif & "_" & "Repair.xls"
Set wbBook5 = Workbooks(Projet)

End Su

--
zapatista6

-----------------------------------------------------------------------
zapatista66's Profile: http://www.excelforum.com/member.php...fo&userid=1195
View this thread: http://www.excelforum.com/showthread.php?threadid=47192

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,119
Default Public declare for Set....

Why not place it into the on open event of the ThisWorkbook module...? Then
the varaibles will be initialized when the book opens...
--
HTH...

Jim Thomlinson


"zapatista66" wrote:


Hi, I have to use many workbooks in my program and I want to set the
name of my workbook once. How can I do that ?

At this moment, I copy SetRefs in all modules and I run it at first,
but is it possible to do that once.

thanks,

Public wbBook1 As Workbook
Public wbBook2 As Workbook
Public wbBook4 As Workbook
Public wbBook5 As Workbook

Public Sub SetRefs()
Dim ProjetActif As Variant, Projet As String
Set wbBook1 = Workbooks("Repair_follow_up.xls")
Set wbBook2 = Workbooks("Repairs.xls")
Set wbBook4 = Workbooks("Clients.xls")
wbBook1.Activate
Sheets("Feuille Calcul").Select
ProjetActif = Cells(3, 5)
Projet = ProjetActif & "_" & "Repair.xls"
Set wbBook5 = Workbooks(Projet)

End Sub


--
zapatista66


------------------------------------------------------------------------
zapatista66's Profile: http://www.excelforum.com/member.php...o&userid=11956
View this thread: http://www.excelforum.com/showthread...hreadid=471920


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Public declare for Set....


I will try again, but I did it and the module didn't recognise wbBook1
as "Repair_Follow_up.xls".

thanks,


--
zapatista66


------------------------------------------------------------------------
zapatista66's Profile: http://www.excelforum.com/member.php...o&userid=11956
View this thread: http://www.excelforum.com/showthread...hreadid=471920

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
Declare and Set Public variables jlclyde Excel Discussion (Misc queries) 2 January 28th 09 02:16 PM
How to declare variable as public. Mark Excel Programming 3 April 7th 05 06:27 PM
PUBLIC DECLARE N10 Excel Programming 0 December 24th 04 06:50 PM
To declare or not to declare Alan Beban[_2_] Excel Programming 9 October 29th 04 10:49 PM
Declare variable as what? N E Body Excel Programming 6 October 28th 04 01:06 AM


All times are GMT +1. The time now is 12:32 AM.

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

About Us

"It's about Microsoft Excel"