Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Question of Import Export Files

Hiyee all,

Until this stage, I'm still considering a newbie in VBA althoug
I can deal with certain userform and some codes.

Anyway, I got a question.... a very basic question for export an
import files. I'm not that understand and don't know much about th
codes that can do so.

My problem is, I created 1 user form, get users entries and th
entries will then placed into excel spreadsheet respectively. Afte
that, I would want to save the spreadsheet to a text file, or wor
file. How can I do tat?

1) How the coding is if we export the data in spreadsheet to notepad ?

2) Can we specify a file name for it?

3) After we saved the file to notepad, where the file will gone? I
which location?

4) Can we auto specify a file name for the file? For example, m
spreadsheet will capture user's computer login(network), and he wil
made entries inside. After that, if he run the macro, it will save hi
file using his login name.

5) About the code that capture user's login name in networ, I saw
thread discuss about this topic yesterday, and I can't find the threa
now... Can anyone tell me where is the thread is?


Thanks a lot.... Hope it wont take ur time to answer my noo
Question... :<

Hope to hear from u all soon...

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Question of Import Export Files

My data in spreadsheet are placed in column A5:F5. And I had define th
range of data as "Range", which is dynamic range that follow the user'
entries...

I had tried an example in my reference book.... but I can't figure ou
the problem... and I'm not understand those codes. I hope I can lear
from u all... Thank

--
Message posted from http://www.ExcelForum.com

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Question of Import Export Files

Thanks God! About my 5th question, I had found the thread...

Anyway, i got a question about it...

' Declare for call to mpr.dll.
Declare Function WNetGetUser Lib "mpr.dll" _
Alias "WNetGetUserA" (ByVal lpName As String, _
ByVal lpUserName As String, lpnLength As Long) As Long

Const NoError = 0 'The Function call was successful

Sub GetUserName()

' Buffer size for the return string.
Const lpnLength As Integer = 255

' Get return buffer space.
Dim status As Integer

' For getting user information.
Dim lpName, lpUserName As String

' Assign the buffer size constant to lpUserName.
lpUserName = Space$(lpnLength + 1)

' Get the log-on name of the person using product.
status = WNetGetUser(lpName, lpUserName, lpnLength)

' See whether error occurred.
If status = NoError Then
' This line removes the null character. Strings in C ar
null-
' terminated. Strings in Visual Basic are no
null-terminated.
' The null character must be removed from the C strings to b
used
' cleanly in Visual Basic.
lpUserName = Left$(lpUserName, InStr(lpUserName, Chr(0)) - 1)
Else

' An error occurred.
MsgBox "Unable to get the name."
End
End If

' Display the name of the person logged on to the machine.
MsgBox "Welcome " & lpUserName

End Sub


The above is the codes to get the user name....Anyway, can the usernam
placed in a cell? If can... How to do that? I want to placed th
username in sheet1 cell "G5".... Is there any method to do so?

and why I cannot put as:
Cells(NextRow,7) = & lpUserName
It gave me the error msg when I put "&" infront....

--
Message posted from http://www.ExcelForum.com

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Question of Import Export Files

Drop the & from this line:

Cells(NextRow,7) = & lpUserName

& is VBA's concatenate operator. It's used to join two pieces of text.

But you just want one.




"unplugs <" wrote:

Thanks God! About my 5th question, I had found the thread...

Anyway, i got a question about it...

' Declare for call to mpr.dll.
Declare Function WNetGetUser Lib "mpr.dll" _
Alias "WNetGetUserA" (ByVal lpName As String, _
ByVal lpUserName As String, lpnLength As Long) As Long

Const NoError = 0 'The Function call was successful

Sub GetUserName()

' Buffer size for the return string.
Const lpnLength As Integer = 255

' Get return buffer space.
Dim status As Integer

' For getting user information.
Dim lpName, lpUserName As String

' Assign the buffer size constant to lpUserName.
lpUserName = Space$(lpnLength + 1)

' Get the log-on name of the person using product.
status = WNetGetUser(lpName, lpUserName, lpnLength)

' See whether error occurred.
If status = NoError Then
' This line removes the null character. Strings in C are
null-
' terminated. Strings in Visual Basic are not
null-terminated.
' The null character must be removed from the C strings to be
used
' cleanly in Visual Basic.
lpUserName = Left$(lpUserName, InStr(lpUserName, Chr(0)) - 1)
Else

' An error occurred.
MsgBox "Unable to get the name."
End
End If

' Display the name of the person logged on to the machine.
MsgBox "Welcome " & lpUserName

End Sub

The above is the codes to get the user name....Anyway, can the username
placed in a cell? If can... How to do that? I want to placed the
username in sheet1 cell "G5".... Is there any method to do so?

and why I cannot put as:
Cells(NextRow,7) = & lpUserName
It gave me the error msg when I put "&" infront.....

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Question of Import Export Files

Still waiting for the answer from somebody..... :

--
Message posted from http://www.ExcelForum.com



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Question of Import Export Files

http://groups.google.com/groups?selm...75E5%40msn.com

"unplugs <" wrote:

Still waiting for the answer from somebody..... :<

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Question of Import Export Files

Thanks Dave... U really help me a lot from the beginning until now...
:

--
Message posted from http://www.ExcelForum.com

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
Import/export netCDF files to Excel Piet Jongejan Excel Discussion (Misc queries) 1 July 22nd 08 12:32 PM
Import & Export lj Excel Discussion (Misc queries) 1 May 13th 08 02:07 AM
Import/Export ecruz04 Excel Discussion (Misc queries) 1 April 27th 07 08:17 AM
Automate Import/Export Steve Excel Discussion (Misc queries) 0 October 14th 05 06:38 PM
Import and Export Todd Huttenstine[_3_] Excel Programming 3 April 30th 04 12:47 AM


All times are GMT +1. The time now is 04:32 PM.

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

About Us

"It's about Microsoft Excel"